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
4 changes: 2 additions & 2 deletions contracts/predictify-hybrid/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ impl AdminFunctions {
/// - `Error::Unauthorized` - Admin lacks FinalizeMarket permission
/// - `Error::MarketNotFound` - Market with given ID doesn't exist
/// - `Error::InvalidOutcome` - Outcome doesn't match market's possible outcomes
/// - `Error::MarketAlreadyResolved` - Market has already been finalized
/// - `Error::MarketResolved` - Market has already been finalized
/// - Resolution errors from MarketResolutionManager
///
/// # Example
Expand Down Expand Up @@ -2384,7 +2384,7 @@ impl AdminValidator {
let admin_exists = env.storage().persistent().has(&Symbol::new(env, "Admin"));

if admin_exists {
return Err(Error::AlreadyInitialized);
return Err(Error::InvalidState);
}

Ok(())
Expand Down
8 changes: 4 additions & 4 deletions contracts/predictify-hybrid/src/batch_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl BatchProcessor {
env.storage()
.instance()
.get(&Symbol::new(env, Self::BATCH_CONFIG_KEY))
.ok_or(Error::ConfigurationNotFound)
.ok_or(Error::ConfigNotFound)
}

/// Update batch processor configuration
Expand Down Expand Up @@ -489,7 +489,7 @@ impl BatchProcessor {
let market = crate::markets::MarketStateManager::get_market(env, &feed_data.market_id)?;

if market.is_resolved() {
return Err(Error::MarketAlreadyResolved);
return Err(Error::MarketResolved);
}

// TODO: Fix oracle call - OracleManager doesn't exist
Expand Down Expand Up @@ -627,7 +627,7 @@ impl BatchProcessor {
env.storage()
.instance()
.get(&Symbol::new(env, Self::BATCH_STATS_KEY))
.ok_or(Error::ConfigurationNotFound)
.ok_or(Error::ConfigNotFound)
}

/// Update batch statistics
Expand Down Expand Up @@ -710,7 +710,7 @@ impl BatchProcessor {
/// Validate oracle feed data
fn validate_oracle_feed_data(feed_data: &OracleFeed) -> Result<(), Error> {
if feed_data.feed_id.is_empty() {
return Err(Error::InvalidOracleFeed);
return Err(Error::InvalidOracleConfig);
}

if feed_data.threshold <= 0 {
Expand Down
4 changes: 2 additions & 2 deletions contracts/predictify-hybrid/src/bets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl BetManager {
///
/// - `Error::MarketNotFound` - Market does not exist
/// - `Error::MarketClosed` - Market has ended or is not active
/// - `Error::MarketAlreadyResolved` - Market has already been resolved
/// - `Error::MarketResolved` - Market has already been resolved
/// - `Error::AlreadyBet` - User has already placed a bet on this market
/// - `Error::InsufficientStake` - Bet amount below minimum
/// - `Error::InvalidOutcome` - Selected outcome not valid for this market
Expand Down Expand Up @@ -800,7 +800,7 @@ impl BetValidator {

// Check if market is not already resolved
if market.winning_outcomes.is_some() {
return Err(Error::MarketAlreadyResolved);
return Err(Error::MarketResolved);
}

Ok(())
Expand Down
12 changes: 6 additions & 6 deletions contracts/predictify-hybrid/src/circuit_breaker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl CircuitBreaker {
env.storage()
.instance()
.get(&Symbol::new(env, Self::CONFIG_KEY))
.ok_or(Error::CircuitBreakerNotInitialized)
.ok_or(Error::CBNotInitialized)
}

/// Update circuit breaker configuration
Expand Down Expand Up @@ -196,7 +196,7 @@ impl CircuitBreaker {
env.storage()
.instance()
.get(&Symbol::new(env, Self::STATE_KEY))
.ok_or(Error::CircuitBreakerNotInitialized)
.ok_or(Error::CBNotInitialized)
}

/// Update circuit breaker state
Expand All @@ -219,7 +219,7 @@ impl CircuitBreaker {

// Check if already paused
if state.state == BreakerState::Open {
return Err(Error::CircuitBreakerAlreadyOpen);
return Err(Error::CBAlreadyOpen);
}

// Update state
Expand Down Expand Up @@ -365,7 +365,7 @@ impl CircuitBreaker {

// Check if circuit breaker is open
if state.state != BreakerState::Open && state.state != BreakerState::HalfOpen {
return Err(Error::CircuitBreakerNotOpen);
return Err(Error::CBNotOpen);
}

// Reset state
Expand Down Expand Up @@ -494,7 +494,7 @@ impl CircuitBreaker {
env.storage()
.instance()
.get(&Symbol::new(env, Self::EVENTS_KEY))
.ok_or(Error::CircuitBreakerNotInitialized)
.ok_or(Error::CBNotInitialized)
}

// ===== STATUS AND MONITORING =====
Expand Down Expand Up @@ -715,7 +715,7 @@ impl CircuitBreakerUtils {
{
// Check if operation should be allowed
if !Self::should_allow_operation(env)? {
return Err(Error::CircuitBreakerOpen);
return Err(Error::CBOpen);
}

// Execute operation
Expand Down
6 changes: 3 additions & 3 deletions contracts/predictify-hybrid/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ impl ConfigManager {
///
/// # Returns
///
/// Returns the stored `ContractConfig` on success, or `Error::ConfigurationNotFound`
/// Returns the stored `ContractConfig` on success, or `Error::ConfigNotFound`
/// if no configuration has been stored.
///
/// # Example
Expand All @@ -2057,7 +2057,7 @@ impl ConfigManager {
///
/// # Error Handling
///
/// This function returns `Error::ConfigurationNotFound` when:
/// This function returns `Error::ConfigNotFound` when:
/// - No configuration has been previously stored
/// - Configuration was stored but corrupted
/// - Storage key doesn't exist or is inaccessible
Expand All @@ -2079,7 +2079,7 @@ impl ConfigManager {
.get::<Symbol, ContractConfig>(&key)
{
Some(config) => Ok(config),
None => Err(Error::ConfigurationNotFound),
None => Err(Error::ConfigNotFound),
}
}

Expand Down
26 changes: 13 additions & 13 deletions contracts/predictify-hybrid/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ impl DisputeManager {
) -> Result<DisputeTimeoutOutcome, Error> {
// Check if timeout has expired
if !Self::check_dispute_timeout(env, dispute_id.clone())? {
return Err(Error::DisputeTimeoutNotExpired);
return Err(Error::TimeoutNotExpired);
}

// Get timeout configuration
Expand Down Expand Up @@ -1854,7 +1854,7 @@ impl DisputeManager {

// Check if timeout can be extended
if !matches!(timeout.status, DisputeTimeoutStatus::Active) {
return Err(Error::DisputeTimeoutExtensionNotAllowed);
return Err(Error::TimeoutNotExpired);
}

// Update timeout
Expand Down Expand Up @@ -1895,7 +1895,7 @@ impl DisputeValidator {

// Check if market is already resolved
if market.winning_outcomes.is_some() {
return Err(Error::MarketAlreadyResolved);
return Err(Error::MarketResolved);
}

// Check if oracle result is available
Expand All @@ -1910,7 +1910,7 @@ impl DisputeValidator {
pub fn validate_market_for_resolution(_env: &Env, market: &Market) -> Result<(), Error> {
// Check if market is already resolved
if market.winning_outcomes.is_some() {
return Err(Error::MarketAlreadyResolved);
return Err(Error::MarketResolved);
}

// Check if there are active disputes
Expand Down Expand Up @@ -1987,12 +1987,12 @@ impl DisputeValidator {
// Check if voting period is active
let current_time = env.ledger().timestamp();
if current_time < voting_data.voting_start || current_time > voting_data.voting_end {
return Err(Error::DisputeVotingPeriodExpired);
return Err(Error::DisputeVoteExpired);
}

// Check if voting is still active
if !matches!(voting_data.status, DisputeVotingStatus::Active) {
return Err(Error::DisputeVotingNotAllowed);
return Err(Error::DisputeVoteDenied);
}

Ok(())
Expand All @@ -2018,7 +2018,7 @@ impl DisputeValidator {
/// Validate voting is completed
pub fn validate_voting_completed(voting_data: &DisputeVoting) -> Result<(), Error> {
if !matches!(voting_data.status, DisputeVotingStatus::Completed) {
return Err(Error::DisputeResolutionConditionsNotMet);
return Err(Error::DisputeCondNotMet);
}

Ok(())
Expand All @@ -2033,13 +2033,13 @@ impl DisputeValidator {
let voting_data = DisputeUtils::get_dispute_voting(env, dispute_id)?;

if !matches!(voting_data.status, DisputeVotingStatus::Completed) {
return Err(Error::DisputeResolutionConditionsNotMet);
return Err(Error::DisputeCondNotMet);
}

// Check if fees haven't been distributed yet
let fee_distribution = DisputeUtils::get_dispute_fee_distribution(env, dispute_id)?;
if fee_distribution.fees_distributed {
return Err(Error::DisputeFeeDistributionFailed);
return Err(Error::DisputeFeeFailed);
}

Ok(true)
Expand All @@ -2063,13 +2063,13 @@ impl DisputeValidator {
}

if !has_participated {
return Err(Error::DisputeEscalationNotAllowed);
return Err(Error::DisputeNoEscalate);
}

// Check if escalation already exists
let escalation = DisputeUtils::get_dispute_escalation(env, dispute_id);
if escalation.is_some() {
return Err(Error::DisputeEscalationNotAllowed);
return Err(Error::DisputeNoEscalate);
}

Ok(())
Expand Down Expand Up @@ -2110,7 +2110,7 @@ impl DisputeValidator {
timeout: &DisputeTimeout,
) -> Result<(), Error> {
if !matches!(timeout.status, DisputeTimeoutStatus::Active) {
return Err(Error::DisputeTimeoutExtensionNotAllowed);
return Err(Error::TimeoutNotExpired);
}

Ok(())
Expand Down Expand Up @@ -2460,7 +2460,7 @@ impl DisputeUtils {
env.storage()
.persistent()
.get(&key)
.ok_or(Error::DisputeTimeoutNotSet)
.ok_or(Error::TimeoutNotSet)
}

/// Check if dispute timeout exists
Expand Down
6 changes: 3 additions & 3 deletions contracts/predictify-hybrid/src/edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl EdgeCaseHandler {
if config.max_single_user_percentage < 0
|| config.max_single_user_percentage > 10000
{
return Err(Error::ThresholdExceedsMaximum);
return Err(Error::ThresholdTooHigh);
}
}
EdgeCaseScenario::LowParticipation => {
Expand Down Expand Up @@ -517,7 +517,7 @@ impl EdgeCaseHandler {
/// Validate edge case configuration.
fn validate_edge_case_config(env: &Env, config: &EdgeCaseConfig) -> Result<(), Error> {
if config.min_total_stake < 0 {
return Err(Error::ThresholdBelowMinimum);
return Err(Error::ThresholdBelowMin);
}

if config.min_participation_rate < 0 || config.min_participation_rate > 10000 {
Expand All @@ -533,7 +533,7 @@ impl EdgeCaseHandler {
}

if config.max_single_user_percentage < 0 || config.max_single_user_percentage > 10000 {
return Err(Error::ThresholdExceedsMaximum);
return Err(Error::ThresholdTooHigh);
}

Ok(())
Expand Down
Loading
Loading