Skip to main content

scemadex_sdk/
oracle.rs

1use async_trait::async_trait;
2use serde::{Deserialize, Serialize};
3
4use crate::error::Result;
5use crate::primitives::Address;
6
7/// Deployer / token reputation distilled from historical rug/success outcomes —
8/// and, under Conviction Routing, from on-chain **bond settlement history**
9/// (honored vs. slashed), which is far harder to fake than self-reported scores.
10#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
11pub struct Reputation {
12    /// `0.0` (rug-prone) … `1.0` (trusted).
13    pub score: f64,
14    pub samples: u32,
15}
16
17/// A predictive 0–100 quality score for a pool.
18#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
19pub struct PoolScore {
20    pub score: f64,
21}
22
23/// A directional suggestion with the agent's conviction and reasoning.
24#[derive(Clone, Debug, Serialize, Deserialize)]
25pub struct Advice {
26    pub action: String,
27    pub conviction: f64,
28    pub reason: String,
29}
30
31/// The read side of the marketplace (Primitive C): signals other agents pay for
32/// per-query via x402. The `scematica` feature serves these from the bot's
33/// reputation ledger, pool scorer, and Deep Q* advice.
34#[async_trait]
35pub trait SignalSource: Send + Sync {
36    async fn reputation(&self, deployer: &Address) -> Result<Reputation>;
37    async fn pool_score(&self, pool: &Address) -> Result<PoolScore>;
38    async fn advice(&self, token: &Address) -> Result<Advice>;
39}