Contract d67379d399e64e6606f87240c8e834ac1bf7c5730fbec13067858f641172c032

← Back to Index 📥 Download WASM

Meta

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

Instances

  • CAXWALT7FW4O2YQU5LVFVJGILA64S76O73Y2HXSB67DEQTM74NIOK6U7
  • CDMBEXZG27KLAUAYVC4BRIIZZDA2FJQCJI5MWLKHVRJC2BVO7CXJAQCG

Interface

fn debt(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> i128

Vendor draws working capital. Gated by available_to — the lesser of the vendor's remaining credit headroom and the pool's free liquidity.

fn draw(env: soroban_sdk::Env, vendor: soroban_sdk::Address, amount: i128)

Vendor repays principal. Overpayment is clamped to the outstanding debt, so only what is owed is pulled.

fn repay(env: soroban_sdk::Env, vendor: soroban_sdk::Address, amount: i128)
fn token(env: soroban_sdk::Env) -> soroban_sdk::Address

Permissionless — anyone (our cron relayer) can trigger this. No vendor auth is required: funds only move up to what the vendor already approved on the token contract, and the on-chain cadence gate below stops it being called early to drain the whole allowance at once.

fn collect(env: soroban_sdk::Env, vendor: soroban_sdk::Address)

LP funds the pool with USDC. Liquidity is custodied by the contract and lent out to score-qualified vendors.

fn deposit(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)
fn registry(env: soroban_sdk::Env) -> soroban_sdk::Address
fn schedule(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
) -> Option
fn min_score(env: soroban_sdk::Env) -> u32
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    registry: soroban_sdk::Address,
)

What the vendor can actually draw right now: remaining credit headroom, capped by available pool liquidity.

fn available_to(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> i128

Total credit line a vendor qualifies for, from their on-chain score. 0 when below the minimum score.

fn credit_limit(env: soroban_sdk::Env, vendor: soroban_sdk::Address) -> i128
fn pool_balance(env: soroban_sdk::Env) -> i128

Vendor opts in to scheduled auto-repay. Requires a matching token.approve(vendor, pool, cap, expiration_ledger) set up separately (frontend calls the token contract directly) — this call only sets cadence/amount, it never touches the allowance.

fn set_schedule(
    env: soroban_sdk::Env,
    vendor: soroban_sdk::Address,
    interval_seconds: u64,
    amount_per_period: i128,
)
fn set_min_score(env: soroban_sdk::Env, admin: soroban_sdk::Address, new_min: u32)

Vendor cancels auto-repay. Does NOT revoke the token allowance — vendor should also token.approve(vendor, pool, 0, ledger) to kill the pull right entirely (works even if this app is unreachable).

fn cancel_schedule(env: soroban_sdk::Env, vendor: soroban_sdk::Address)

Imports

WebAssembly Text (WAT) ▶