Concept · 04

Code-as-Collateral Lending

Borrow USDC or $GSEA against a repo's live cash flow. The lending curve prices off real economics — MRR, network gravity, contributor concentration, churn — not collateral that just sits there.

In plain English

Your repo has cash flow (from streams + merges). That cash flow is collateral. You can borrow against it — fund an audit, cover a hosting bill, give a contributor a week off — and repay automatically out of incoming streams. No bank. No pitch deck.

What it is

A repo with a balance sheet has equity, income, and a credit score. That's enough to underwrite a loan.

Maintainers can draw from a credit line opened against the repo. The credit is non-custodial — the protocol takes a programmatic claim against future royalty streams until the loan is repaid. No bank, no committee, no pitch deck.

How it works

v1 (shipped): An authorized underwriter opens a credit line per (collateralKind, collateralId, borrower) triple by calling CreditLine.openLine(...). The line carries a flat interestBps (basis-point interest applied at draw time) and a term in days. The underwriter pre-funds the cap. The borrower calls draw(lineId, amount) to pull funds, accruing amount × (10_000 + interestBps) / 10_000 in owed. Repay any time via repay(lineId, amount). After the dueBy timestamp anyone can call markDefault(lineId).

The lifecycle states: Open → Drawn → Repaid (or → Defaulted).

v2 (planned): A tranched lender pool with per-grade pricing and the continuous lending curve below replaces the per-line underwriter. Same on-chain interface — the difference is who funds the cap and how the rate is set.

The forward-looking lending curve (v2 design):

max_draw = α × ttm_mrr           // forward-looking cash flow capacity
        + β × treasury_buffer    // current cushion
        + γ × score(repo)        // proven reliability
        − δ × churn_risk         // contributor concentration & churn
        − ε × outstanding_debt

Where ttm_mrr is trailing-twelve-months royalty income. Coefficients (α, β, γ, δ, ε) are set by governance and refined as real data arrives.

Drawing

asset draw 5000 usdc --collateral acme/date-fp --term 90d

This signs a one-tx draw on Base. USDC arrives in the requester's wallet. A claim is registered against the repo's incoming streams until repaid + interest.

Repayment

Three modes, choose at draw time:

ModeHow it repays
Stream-firstEvery incoming stream is auto-routed to debt service until clear, then to splits. Lowest rate.
BalloonSplits flow normally; principal due at term. Higher rate; useful for one-shot funding (audit, infra).
HybridX% of streams to debt, rest to splits. Tunable.

Default

If a credit line is unpaid at term and the repo's TTM MRR is insufficient to cover, the protocol:

  1. Pauses outbound splits and routes all incoming streams to the lender.
  2. Marks the repo's credit score down by a governance-set penalty.
  3. Allows the lender to claim the repo's underwriting collateral if any.
  4. Optionally allows the repo to be put up for dependency assumption — another repo takes over maintenance + the debt for a discount.

There is no liquidation of "the code" because code can't be liquidated. The penalty is economic and reputational.

Concrete example

ExampleFunding a Trail of Bits auditacme/date-fp · A+ grade

Day 1. Repo has $4,212 treasury, $87.40 MRR, score 812. Curve quote: max draw = $50,000 (12.4% APR, stream-first).

Day 1. Maintainer draws $5,000 USDC, pays Trail of Bits.

Day 8. First stream tick — $20.40 inbound. $20.40 → debt service, splits paused.

Day 90. Across 13 epochs, $1,134 retired. Outstanding: $4,031.

Day 380. Loan fully retired from streams alone. Splits resume. Audit shipped a year ago. Reputation up.

Net: zero out-of-pocket from the maintainer. The code paid for its own audit.

Pricing

Rates are governance-set bands, refined by realized loss data:

GradeBase APRNotes
A+7–10%Score 850+, TTM MRR > $1k, low churn.
A10–14%Score 750+, regular activity.
B14–20%Score 650+, capped principal.
C22–30%Score 500+, principal cap × MRR multiple.
Dn/aNo credit. Use bounties.

Repayment mode adjusts the rate (stream-first −2%, balloon +3%).

Lenders

On the other side of the line are lender pools funded by stakers seeking yield. Lenders don't pick individual repos; they pick a tranche by grade and accept the realized yield.

Senior tranche absorbs defaults last; junior tranche absorbs first and earns more. Same standard tranching, applied to OSS cash flow.

Gotchas