THE KEY PUBLIC FUNCTION.
Returns the Anchor Confidence Ratio (ACR) for an anchor in basis points. This is now a composite Operational Risk Score, scaled 0 to 10_000.
fn get_acr(env: soroban_sdk::Env, anchor: soroban_sdk::Address) -> i128
fn extend_ttl(env: soroban_sdk::Env)
Called once at deployment.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
factory: soroban_sdk::Address,
usdc: soroban_sdk::Address,
)
Returns all registered anchors and their ACR scores.
fn get_all_acr(env: soroban_sdk::Env) -> soroban_sdk::Vec<(soroban_sdk::Address, i128)>
fn get_all_metrics(
env: soroban_sdk::Env,
) -> soroban_sdk::Vec<(soroban_sdk::Address, AnchorMetrics, i128)>
Anchor registers itself for a specific market.
fn register_anchor(env: soroban_sdk::Env, anchor: soroban_sdk::Address, market_id: u32)
fn on_market_settled(env: soroban_sdk::Env, market_id: u32, yes_won: bool)
fn get_cover_outstanding(env: soroban_sdk::Env, market_id: u32) -> i128
Update operational metrics for an anchor. This is called by the off-chain Watcher (Risk Oracle) via the admin key.
fn update_anchor_metrics(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
anchor: soroban_sdk::Address,
success_rate_bps: u32,
avg_latency_seconds: u32,
failed_withdrawals: u32,
oracle_uptime_bps: u32,
historical_payouts: i128,
)
fn update_cover_outstanding(
env: soroban_sdk::Env,
market_id: u32,
delta: i128,
increase: bool,
)