Contract 6c83fa459352917c32ba2877a4f2e9c887ff866ec10b4a68c968d0aefd5dc8b3

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CDW5HJWCXIAUI27F3WZRSFU4LETD7KIDOGTP4LEKFACETQVIFWV7XKIG

Interface

fn token(env: soroban_sdk::Env) -> soroban_sdk::Address

Admin swaps the contract's executable WASM. Preserves storage. Mainnet escape hatch for bug fixes — no redeploy = no new contract ID = no state migration.

fn upgrade(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    new_wasm_hash: soroban_sdk::BytesN<32>,
)
fn get_utang(env: soroban_sdk::Env, utang_id: u64) -> Utang

Admin swaps the settlement token. BLOCKED while any utang is Active — otherwise in-flight utangs would have stranded reserve funds in the old token. Admin must coordinate: freeze new utang creation off-chain, let all active utangs complete or be defaulted, then call set_token.

fn set_token(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    new_token: soroban_sdk::Address,
)
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    native_token: soroban_sdk::Address,
)

View: true if utang is Active and now > next_due + grace_period.

fn is_overdue(env: soroban_sdk::Env, utang_id: u64) -> bool
fn utang_count(env: soroban_sdk::Env) -> u64

Vendor creates utang agreement. First installment NOT collected here — customer pays each installment separately via pay_installment().

fn create_utang(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    customer: soroban_sdk::Address,
    total_amount: i128,
    installments_total: u32,
    interval_seconds: u64,
    description: soroban_sdk::String,
) -> u64
fn grace_period(env: soroban_sdk::Env) -> u64

Admin marks utang defaulted. Requires now > next_due + grace_period. Pays out accumulated reserve to vendor and increments customer/vendor default counters.

fn mark_default(env: soroban_sdk::Env, admin: soroban_sdk::Address, utang_id: u64)
fn utang_reserve(env: soroban_sdk::Env, utang_id: u64) -> i128
fn pay_installment(
    env: soroban_sdk::Env,
    customer: soroban_sdk::Address,
    utang_id: u64,
)
fn vendor_defaults(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> u32
fn max_utang_amount(env: soroban_sdk::Env) -> i128

Admin can adjust grace period (seconds past next_due before default allowed).

fn set_grace_period(env: soroban_sdk::Env, admin: soroban_sdk::Address, seconds: u64)
fn customer_defaults(env: soroban_sdk::Env, customer: soroban_sdk::Address) -> u32
fn get_vendor_utangs(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    limit: u32,
    offset: u32,
) -> soroban_sdk::Vec

Customer pays late fee to resume a defaulted utang. Late fee = installment_amount * LATE_FEE_BPS / 10_000, paid direct to vendor. Status flips back to Active, next_due resets to now + interval.

fn resume_after_late(
    env: soroban_sdk::Env,
    customer: soroban_sdk::Address,
    utang_id: u64,
)
fn active_utang_count(env: soroban_sdk::Env) -> u64
fn get_customer_utangs(
    env: soroban_sdk::Env,
    customer: soroban_sdk::Address,
    limit: u32,
    offset: u32,
) -> soroban_sdk::Vec

Admin sets the cap on total_amount accepted by create_utang. Mainnet protection against runaway BNPL principal (e.g., cap at ₱5k worth of token stroops).

fn set_max_utang_amount(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    new_max: i128,
)

Imports

WebAssembly Text (WAT) ▶