Runway

Worked examples and formulas

One merchant, one lender and one loan, followed through every payment with every balance, using the contracts' exact integer maths. You can reproduce each number in the Simulator.

The setup

  • A lender deposits 10,000 USDC into an empty vault. Runway seeds a 100 USDC reserve.
  • The INR gateway holds a 5,000 USDC float; the INR treasury holds ₹5,00,000.
  • Rate ₹100.00 per USDC, spread 0.5%. The merchant starts with nothing and is paid in USDC.

Step by step

1. The lender deposits 10,000 USDC

shares = 10,000 × (0 + 1) ÷ (0 + 1)= 10,000 shares, price 1.000000

2. A 400 USDC crypto sale, no loan

The customer pays about 404 USDC on Base (the extra is swap fees, outside Runway). 1Click delivers exactly 400 USDC to the settlement account. settle(): no loan, so repay = 0 and all 400 go to the merchant. The vault doesn't change: the money only passes through.

3. A ₹10,000 UPI sale, no loan

USDC = ₹10,000 ÷ 100 × 99.5%= 99.50 USDC

The treasury gains ₹10,000 (worth 100 USDC), the float pays 99.50. The 0.50 difference is the gateway's spread. The merchant gets 99.50 USDC.

4. The offer (no money moves)

three windows of 400 → score 42.50= grade C
limit = min(400 × 0.3 = 120, first-loan cap 100, 15,000, repayable 272.7)= 100
repay share = ceil(110 × 10,000 ÷ 1,200) bps = 917 bps= 9.17%

5. The merchant accepts 100 USDC

Cash 10,000 → 9,900, loans outstanding 0 → 100. The vault's value is still 10,000, so the share price doesn't move: lending turns cash into a loan of the same value.

6. A 400 USDC sale during the loan

repay = floor(400 × 917 ÷ 10,000)= 36.68 to the loan, 363.32 to the merchant
principal part = floor(36.68 × 100 ÷ 110)= 33.345454
fee part = 36.68 − 33.345454= 3.334546 (0.333454 to the reserve, 3.001092 to lenders)

7. A ₹10,000 UPI sale during the loan

The gateway delivers 99.50 USDC as in step 3, and it is split like any sale: 9.12415 repays the loan, 90.37585 reaches the merchant.

8. A 1,200 USDC sale finishes the loan

Still owed: 110 − 45.80415 = 64.19585. The repay part would be 110.04, but only 64.19585 is needed, so the extra 45.84415 goes back to the merchant: 1,089.96 + 45.84415 = 1,135.80415. The loan is Repaid and later sales go 100% to the merchant.

All the balances

AfterMerchantVault cashLoans outVault valueShare priceReserveFloatTreasury
1 Deposit010,000010,0001.0000001005,000₹5,00,000
2 Crypto 40040010,000010,0001.0000001005,000₹5,00,000
3 UPI ₹10,000499.5010,000010,0001.0000001004,900.50₹5,10,000
5 Loan 100599.509,90010010,0001.0000001004,900.50₹5,10,000
6 Crypto 400962.829,936.3566.6510,003.001.000300100.334,900.50₹5,10,000
7 UPI ₹10,0001,053.209,945.3958.3610,003.751.000375100.424,801.00₹5,20,000
8 Crypto 1,2002,189.0010,009.00010,009.001.000899101.004,801.00₹5,20,000

Check the totals. The merchant's sales were 400 + 400 + 1,200 in crypto plus 2 × 99.50 from UPI = 2,199; add the 100 loan and subtract the 110 repaid = 2,189. The 10 USDC fee went 9.000002 to lenders and 0.999998 to the reserve. The live testnet vault shows almost exactly these numbers after its own test loan: cash 10,009.000002, share price 1.000899.

9. The lender withdraws 1,000 shares

1,000 × (10,009.000002 + 1) ÷ (10,000 + 1)= 1,000.899910 USDC

In rupees instead: 1,000.899910 × 100 × 99.5% = ₹99,589.54 to the lender's UPI ID; the float goes up 1,000.90 and the treasury down ₹99,589.54. The share price is unchanged for everyone else.

When a merchant stops paying

Same vault, loan of 100 just disbursed, and no sales at all:

MomentLoanProvisionsVault cashVault valueShare priceReserve
DisbursedActive09,90010,0001.000000100
Period 1 ends (repaid 0 of 11 needed)Delinquent509,9009,9500.995000100
Period 2 ends (missed again)Defaulted010,00010,0001.0000000

The reserve paid the whole 100, so lenders end whole. With only 30 in the reserve, the vault would end at 9,930 and every share would lose 0.7%. If the merchant pays during period 2 instead, the loan returns to Active and the provision is released.

All the formulas

WhatFormula
Vault value (NAV)cash + loans outstanding − provisions
Share price(vault value + 1) ÷ (total shares + 1)
Shares for a depositdeposit × (shares + 1) ÷ (value + 1)
USDC for shares at claimshares × (value + 1) ÷ (shares + 1)
Split of each paymentrepay = floor(payment × repay share); merchant = the rest; no loan → repay = 0
Fee and amount owedfee = loan × fee %; owed = loan + fee
Principal part of a repaymentfloor(total repaid × loan ÷ owed) − principal already repaid
Fee partrepayment − principal part; 10% to the reserve, 90% to the vault
Minimum per loan period10% of owed (or what's left, if less)
Provision while delinquent50% of the unpaid principal
Defaultunpaid principal written off; reserve pays first
Score35 × stability + 25 × history + 15 × diversity + 15 × trend + 10 × corroboration; C ≥ 40, B ≥ 55, A ≥ 75
Limitmin(median window × k, tier cap, 15,000, 3 × median × 25% ÷ (1 + fee)); k = 1.0 / 0.6 / 0.3 for A / B / C
Repay shareowed ÷ (3 × median window), between 5% and 25%
₹ → USDCfloor(paise × 1,000,000 × 9,950 ÷ (rate × 10,000))
USDC → ₹floor(USDC × rate × 9,950 ÷ (1,000,000 × 10,000))
Everything is integer maths, rounded down, in millionths of a USDC and in paise. That is why some numbers end in …454 or …998: the browser previews on this site use the same integers, so they always match the chain.