From 7a326f2304a3c15a408c4037eb9332e9dc700bdf Mon Sep 17 00:00:00 2001 From: mikewheeleer Date: Tue, 30 Jun 2026 02:15:03 +0530 Subject: [PATCH] feat: add set/get oracle price-confidence threshold entrypoints (#735) --- contracts/predictify-hybrid/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/contracts/predictify-hybrid/src/lib.rs b/contracts/predictify-hybrid/src/lib.rs index 0ded06ce..45269176 100644 --- a/contracts/predictify-hybrid/src/lib.rs +++ b/contracts/predictify-hybrid/src/lib.rs @@ -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,