Contract 2fc4965ad418da610320dc69c544f77cecb9df9ed930c591b8c2191b27c7439b

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.95.0

Instances

  • CDFWQJY72GPH7PEQVFGBDZESZNVRF6LQLVWU42CFMWPGRME5RWN5AXSX

Interface

Record a rating for a completed job.

  • caller must be the registered scorer (the backend JobManager).
  • rating_0_to_100 is stored as basis points (× 100 → 0..10_000).
  • weight is the job's USDC value in stroops, 0 < weight ≤ MAX_WEIGHT.
  • (agent_id, job_id) can only ever be rated once (persistent guard).
  • payer accrues cumulative stake for off-chain Sybil analysis.
  • kind == "dispute" additionally bumps the lifetime dispute counter.
fn submit(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    agent_id: soroban_sdk::Symbol,
    job_id: soroban_sdk::BytesN<16>,
    rating_0_to_100: u32,
    weight: i128,
    payer: soroban_sdk::Address,
    kind: soroban_sdk::Symbol,
) -> Result<(), soroban_sdk::Error>

View — decayed weighted mean in basis points (0..10_000, since sum_w already carries the × 100 scale). 0 when weight == 0.

fn avg_bps(env: soroban_sdk::Env, agent_id: soroban_sdk::Symbol) -> u32

View — Bayesian-smoothed mean: (prior_weight × prior_bps + sum_w) / (prior_weight + weight). The caller-supplied prior anchors low-evidence agents; as decayed evidence weight grows the result converges to the raw mean. Returns prior_bps when both weights are 0. Clamped to 0..10_000.

fn rep_bps(
    env: soroban_sdk::Env,
    agent_id: soroban_sdk::Symbol,
    prior_bps: u32,
    prior_weight: i128,
) -> u32

View — the agent's RepState decayed to now (nothing is written).

fn rep_state(env: soroban_sdk::Env, agent_id: soroban_sdk::Symbol) -> RepState

Admin-only: swap the scorer address.

fn set_scorer(
    env: soroban_sdk::Env,
    new_scorer: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

View — cumulative (never decayed) weight this payer has contributed to this agent's reputation. 0 by default. Raw evidence for off-chain Sybil / self-dealing analysis.

fn payer_weight(
    env: soroban_sdk::Env,
    agent_id: soroban_sdk::Symbol,
    payer: soroban_sdk::Address,
) -> i128
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    scorer: soroban_sdk::Address,
)

View — lifetime dispute rate in basis points: disputed × 10_000 / count. 0 when count == 0. Never decayed.

fn dispute_rate_bps(env: soroban_sdk::Env, agent_id: soroban_sdk::Symbol) -> u32

Imports

WebAssembly Text (WAT) ▶