How it works

Two costs, one unit

Selling costs a lump, once. Borrowing costs a rate, forever. Everything below is how Kerf measures each of them against live state, and what it sends when you decide.

The kerf

A kerf is the width of the slot a saw cuts. It is the wood that becomes dust: not in the plank you keep, not in the offcut, just gone. Selling a position has the same thing in it, and Kerf measures it against the price the lending market uses — Robinhood's own feed, read through the market's oracle — because that is the number both routes can be judged by.

kerf = (shares sold × the tape) − (dollars received)

It divides into three parts, and the app shows all three:

  • The pools' fee. What the liquidity providers charge on the shares going in — 0.01% to 1% depending on the pool.
  • Price impact. What your own sale does to the price as it walks down the book. This is the part that grows with size, and on this chain it grows quickly.
  • The venue gap. The difference between the pool's price at rest and the tape. It is paid on a small sale and a large one alike, and it is often the largest of the three.

Selling an exact amount

Kerf is never asked what forty shares fetch. It is asked to raise $5,000, so every leg it builds is exact-output: the pool is asked for a stated number of dollars and paid whatever that costs. The amount raised is then exact by construction, and what varies is the number of shares — which is what the guard is on. The router is given a ceiling of shares, hands back whatever it did not need in the same transaction, and the final sweep reverts unless the full amount of dollars is there.

A stock here does not have one market. There are pools across stocks, in two versions of Uniswap, and the deepest is rarely deep enough on its own. So the sale is divided, and the rule for dividing it is this: at the best division every pool used has been pushed to the same marginal price — the next share would fetch the same number of dollars wherever it went. That turns a search over divisions into a search over one number, which Kerf bisects.

Pricing hundreds of candidate divisions through a Quoter would be hundreds of round trips, so js/sim.js is a BigInt port of Uniswap's own swap arithmetic — TickMath, SqrtPriceMath and SwapMath, with the same roundings, in both directions. It runs in your browser with no RPC at all. What keeps it honest is that the same code is checked against Uniswap's deployed QuoterV2 and V4Quoter on the live chain, and required to agree to the wei.

Borrowing instead

The loan is a Morpho Blue position: you pledge shares, you draw dollars, and the market's oracle decides what the shares are worth for that purpose. Each market has a liquidation threshold (LLTV) fixed at creation. Kerf never offers a loan at the threshold — it offers 75% of it — and it shows the oracle price at which the position becomes liquidatable, together with how far below the tape that is.

The rate is not a constant, and that matters more here than anywhere. Morpho's AdaptiveCurveIrm is a straight line through a rate-at-target, four times steeper above 90% utilisation than below — and while a market stays above that line, the whole curve climbs, multiplying by e50·err per year. The markets on this chain are small and already 80–96% drawn, so a borrower taking a real share of one is sitting exactly there.

So Kerf does not quote today's rate for a ninety-day loan. It recomputes the curve at the utilisation your loan would create, projects the drift forward with the contract's own maths, and compounds it the way Morpho compounds it. On a fork, thirty days of a live loan cost what the projection said it would, where today's rate alone was out by tens of per cent. The assumption it rests on is stated: nobody else supplies or repays in the meantime.

The break-even, and the mix

A lump and a rate are not comparable until you add time. Interest reaches the kerf after some number of days; before that day, borrowing was the cheaper way to have held the money. Kerf states that day. It is not advice — how long you will owe it is something only you know.

When no market will lend the whole amount, the question narrows: borrow everything the markets have, sell the rest, and how long before the interest on that part eats the kerf it saved? That is what the break-even means in the capped case, and the app says which of the two it is showing.

The mix is usually the cheapest answer, and not as a compromise. The first dollar borrowed is nearly free while the last dollar sold is expensive, so total cost is a curve with a bottom in it. Kerf sweeps that curve and refines around the bottom, re-optimising the sale at every point, because the two legs are not independent: shares pledged cannot also be sold.

What actually gets sent

Kerf deploys no contract. Each route is a call to something already live:

  • Sell — one execute on Uniswap's Universal Router: PERMIT2_TRANSFER_FROM pulls the share ceiling in once, one V3_SWAP_EXACT_OUT or V4_SWAP per pool, then two sweeps — the dollars to you, with a minimum on the total, and the unused shares back to you.
  • Borrow — one multicall on Morpho's Bundler3: the adapter pulls your shares, pledges them to your position, and draws the dollars to you.
  • Both — one Bundler3 bundle that does the loan and then hands the sale shares to the Universal Router through Permit2, so a mixed raise is a single transaction that either happens completely or not at all.

The router on this chain is a newer build than the public documentation describes: its swap inputs carry a trailing minHopPriceX36 that the documented layout does not. Kerf encodes from the verified source of the deployed contract. Getting that wrong does not fail loudly — quotes keep working and only the trade reverts.

What has been checked

Each of these runs against the live chain or a fork of it. The numbers come from the results files, not from this sentence.

loading…
  • Properties and a fuzz — the things one run cannot show: that the legs sum to the amount asked for, that dividing a sale beats every single pool, that the loan maths inverts, that no route spends shares you do not hold. Run against real pool and market state frozen at a block, plus three hundred random draws of size, holding and book.
  • Deliberate bugs — fourteen plausible mistakes written into copies of the arithmetic on purpose: a rounding turned the wrong way, a fee grossed up the wrong way, a flattened rate curve, a sale that stops dividing. Every one that the data can express has to be caught, and the one that cannot is declared with the measurement that says so.
  • The simulator against Uniswap's quoters — exact-input and exact-output, both pair orderings, v3 and v4, at sizes that cross ticks. Agreement is required to the wei.
  • The rate curve against Morpho's IRM — every market on the chain, including ones nobody has touched for weeks, where the stored rate has drifted.
  • The transactions, on a fork — a sale raises exactly the amount asked for and costs exactly the shares shown; a loan pays out exactly what was offered at the rate predicted; a mixed raise does both in one transaction; the guards revert; the interest projected is the interest charged; and a feed that has gone quiet offers no loan.

Getting onto the chain

Kerf operates no bridge and never holds your funds. Robinhood document the ways in themselves, and these are their routes: the canonical Arbitrum portal, which takes about ten minutes, and Relay, which is faster and third-party. Their own bridging documentation is the place to start if neither is familiar.

You need two things here: a little ETH for gas, and either dollars (USDG) or a tokenized stock. On a phone, open this page inside your wallet's own browser — the Connect button offers the links.

What Kerf does not do

  • It does not watch your loan. There is no alert, no auto-repay and no top-up. If the stock falls to the price shown, somebody will liquidate you.
  • It does not price hooked v4 pools. A pool with a hook can re-price at swap time, so those are left out entirely rather than guessed at.
  • It does not read past its window. Pool state is read far enough to cover a 50% price move; a sale that would walk past that is refused rather than extrapolated.
  • It is not advice. Selling is permanent and borrowing can be called in. Kerf measures; the decision is yours.

Risks worth reading twice

  • Liquidation. A Morpho position is closed by anyone when the oracle price falls far enough, and the liquidator keeps a share of the collateral.
  • Oracles go quiet. Some feeds here stop answering after a day. A market priced by a silent feed cannot be borrowed from — repaying still works, which is the side that matters.
  • Rates climb. The markets are small. Someone else borrowing after you moves the rate you pay, in the same direction as your own borrowing did.
  • Thin pools. Some of these stocks cannot be sold in size at any sensible price. The board says which, rather than quoting a number that would not survive contact.