Contract b6cb15b66031203f63774b0771f4af5560721611caa064d01969828507c0ce0c

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CCTB5OMKU6DITCWOFM7LVZENSJXR3VSABAWG3GRXTFPXDPBH2FKATOLX

Interface

fn signers(env: soroban_sdk::Env) -> soroban_sdk::Vec

Multisig-gated: swaps the contract's executable WASM. Preserves storage. Deliberately NOT single-admin-gated — a compromised lone admin key upgrading in a WASM that strips the multisig checks out of increment_stats/report_default/etc. would defeat the whole point of Phase 2. Costs the fast unilateral emergency-hotfix path; that trade is accepted for this contract. See CREDIT_SCORE_ORACLE_FIX.md.

fn upgrade(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    new_wasm_hash: soroban_sdk::BytesN<32>,
)
fn has_rated(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    tx_hash: soroban_sdk::BytesN<32>,
) -> bool
fn threshold(env: soroban_sdk::Env) -> u32
fn get_rating(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    tx_hash: soroban_sdk::BytesN<32>,
) -> Rating
fn get_vendor(env: soroban_sdk::Env, wallet: soroban_sdk::Address) -> VendorRecord
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Rotates the committee/threshold. Requires the CURRENT committee's sign-off, not the admin key — otherwise a lone admin could always re-bootstrap a trivial 1-of-1 "multisig" and the whole thing is theater.

fn set_signers(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    new_signers: soroban_sdk::Vec,
    new_threshold: u32,
)
fn v1_registry(env: soroban_sdk::Env) -> Option
fn apply_vendor(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
    market_id: soroban_sdk::String,
    name: soroban_sdk::String,
    stall_number: soroban_sdk::String,
    phone: soroban_sdk::String,
    product_type: soroban_sdk::String,
)
fn vendor_count(env: soroban_sdk::Env) -> u64
fn pending_count(env: soroban_sdk::Env) -> u32
fn reject_vendor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    wallet: soroban_sdk::Address,
)
fn submit_rating(
    env: soroban_sdk::Env,
    customer: soroban_sdk::Address,
    vendor: soroban_sdk::Address,
    tx_hash: soroban_sdk::BytesN<32>,
    stars: u32,
    comment_hash: soroban_sdk::BytesN<32>,
)
fn approve_vendor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    wallet: soroban_sdk::Address,
)

Manual-override / dispute-resolution path — the routine path is the permissionless record_default_from_utang above, which reads the real Defaulted status straight off utang-escrow. Multisig-gated (Phase 2), same reasoning as increment_stats.

fn report_default(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    vendor: soroban_sdk::Address,
    customer: soroban_sdk::Address,
)
fn update_profile(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    name: soroban_sdk::String,
    stall_number: soroban_sdk::String,
    phone: soroban_sdk::String,
    product_type: soroban_sdk::String,
)
fn escrow_contract(env: soroban_sdk::Env) -> Option
fn get_all_vendors(
    env: soroban_sdk::Env,
    limit: u32,
    offset: u32,
) -> soroban_sdk::Vec
fn get_application(
    env: soroban_sdk::Env,
    wallet: soroban_sdk::Address,
) -> VendorApplication

Manual-override / dispute-resolution path — the routine path is the permissionless record_activity_from_payment/_installment above. Multisig-gated (Phase 2): this is the actual "one key can't fabricate a score" close, since this was the fabrication vector the judge flagged in the first place.

fn increment_stats(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    vendor: soroban_sdk::Address,
    amount: i128,
)
fn register_vendor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    wallet: soroban_sdk::Address,
    market_id: soroban_sdk::String,
    name: soroban_sdk::String,
    stall_number: soroban_sdk::String,
    phone: soroban_sdk::String,
    product_type: soroban_sdk::String,
) -> u64
fn set_v1_registry(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    contract: soroban_sdk::Address,
)

Computes a FICO-style on-chain credit score (300–850) for a vendor from their settled cashflow, transaction count, customer ratings, and default history. Deterministic and side-effect free — this is the RWA primitive: the informal economy's creditworthiness derived purely from on-chain state. Returns the 300 floor for unknown/inactive vendors. Consumed by CreditPool to gate score-based working-capital draws.

fn get_credit_score(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> u32
fn payment_contract(env: soroban_sdk::Env) -> Option
fn deactivate_vendor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    wallet: soroban_sdk::Address,
)
fn get_vendor_rating(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> (u32, u32)
fn get_pending_vendors(
    env: soroban_sdk::Env,
    limit: u32,
    offset: u32,
) -> soroban_sdk::Vec

One-time, admin-gated bootstrap of the multisig committee — the last thing the single admin key is ever needed for on this path. After this runs, set_payment_contract/set_escrow_contract/ increment_stats/report_default/set_signers/upgrade all require threshold-of-signers, never the admin key alone again.

fn migrate_to_multisig(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    signers: soroban_sdk::Vec,
    threshold: u32,
)
fn set_escrow_contract(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    contract: soroban_sdk::Address,
)
fn set_payment_contract(
    env: soroban_sdk::Env,
    signers: soroban_sdk::Vec,
    contract: soroban_sdk::Address,
)

Permissionless. Mirrors a vendor's identity fields (not stats — those start fresh at 0 here; real activity accrues from that point via record_activity_from_payment/_installment) from the real v1 vendor onboarding registry, so a vendor approved there isn't silently invisible to scoring here. No-op if already present in this registry (never clobbers real accrued stats). Traps if wallet has no v1 record — same as any other lookup-by-address call in this contract (e.g. get_vendor), so callers should only invoke this for wallets they know are real v1 vendors (e.g. reacting to a v1 VendorRegisteredEvent/approve_vendor call).

fn mirror_vendor_from_v1(env: soroban_sdk::Env, wallet: soroban_sdk::Address)
fn vendor_defaults_received(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> u32
fn customer_defaults_history(
    env: soroban_sdk::Env,
    customer: soroban_sdk::Address,
) -> u32

Reads utang status from utang-escrow; if Defaulted and not already processed, bumps the same VendorDefaultsReceived/CustomerDefaultsHistory counters as the admin-only report_default — but driven by the real on-chain state, not an admin's claim.

fn record_default_from_utang(env: soroban_sdk::Env, utang_id: u64)

Anyone can call. Reads the payment by ID from the configured PaymentContract and credits the vendor's stats exactly once — a no-op (not a panic) if this payment_id was already processed, so a relayer can safely call this speculatively/repeatedly.

fn record_activity_from_payment(env: soroban_sdk::Env, payment_id: u64)

Reads current installments_paid from utang-escrow and credits only the delta since the last call (handles the final/remainder installment correctly by capping cumulative paid at total_amount).

fn record_activity_from_installment(env: soroban_sdk::Env, utang_id: u64)

Imports

WebAssembly Text (WAT) ▶