Contract 9e2bb51552d408f74ccf5209c824e28252b7a878d27764e1847ed26f0928ef93

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 23.0.0#717595da8e7ca090a326116bfffb6aa4d4c74004
rsver 1.95.0

Instances

  • CCX7LH2BQUV35ALSGQPP3N7ZNLZVJQJVXSAPJELHOPWWAQ3DZ3XP4HIQ

Interface

Initialize the ZK verifier with admin and verification key

Arguments

  • admin - Admin address for emergency controls
  • verification_key - Groth16 verification key (public parameters)
  • min_score - Minimum acceptable credit score (0-1000)
fn init(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    verification_key: VerificationKey,
    min_score: u32,
)

Get credit score for a user (if not expired)

Returns

  • Option<CreditScore> - Score if exists and not expired, None otherwise
fn get_score(env: soroban_sdk::Env, user: soroban_sdk::Address) -> Option

Admin: Emergency pause

fn set_pause(env: soroban_sdk::Env, caller: soroban_sdk::Address, paused: bool)

Admin: Set minimum score threshold

fn set_min_score(env: soroban_sdk::Env, caller: soroban_sdk::Address, min_score: u32)

Check if user has valid credit score above minimum

fn is_creditworthy(env: soroban_sdk::Env, user: soroban_sdk::Address) -> bool

Admin: Update verification key (e.g., if compromised)

fn update_verification_key(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    new_key: VerificationKey,
)

Verify a ZK proof and store the credit score

Arguments

  • user - User address claiming the credit score
  • proof - Groth16 proof (alpha, beta, gamma, delta)
  • public_inputs - Public inputs [score, timestamp, user_hash, ...]
  • nonce - Unique nonce to prevent replay attacks

Returns

  • bool - True if proof is valid and score stored

Panics

  • If contract is paused
  • If nonce already used
  • If proof verification fails
  • If score below minimum threshold
fn verify_score_with_proof(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    score: u32,
    merkle_root: MerkleRoot,
    merkle_proof: soroban_sdk::Vec>,
    nonce: ProofNonce,
) -> bool

Imports

WebAssembly Text (WAT) ▶