Skip to content
Merged
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
21 changes: 21 additions & 0 deletions contracts/predictify-hybrid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,27 @@ impl PredictifyHybrid {
/// # Events
///
/// State-changing paths may emit events through internal managers; read-only query paths emit no events.
/// Set the minimum oracle price-confidence threshold in basis points.
/// Prices from oracles with confidence ratio above this threshold are rejected.
/// `min_confidence_bps` = 0 disables the check.
pub fn set_oracle_confidence_threshold(env: Env, admin: Address, min_confidence_bps: u32) {
admin.require_auth();
if min_confidence_bps > 10_000 {
panic_with_error!(env, Error::InvalidInput);
}
env.storage()
.instance()
.set(&Symbol::new(&env, "oracle_conf_bps"), &min_confidence_bps);
}

/// Get the configured oracle confidence threshold in bps (0 = disabled).
pub fn get_oracle_confidence_threshold(env: Env) -> u32 {
env.storage()
.instance()
.get(&Symbol::new(&env, "oracle_conf_bps"))
.unwrap_or(0u32)
}

pub fn admin_override_verification(
env: Env,
admin: Address,
Expand Down
Loading