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)