What lending against tokenized equities is
Start with the boring version. You hold some shares. You pledge them to a lender, the lender gives you euros, you pay interest, and when you pay the euros back you get the shares back. Banks call it a Lombard loan. If the shares fall too far, the lender sells enough of them to cover the loan.
Now swap the shares for a token that tracks them. The token lives on a chain, so it moves around the clock, anyone with a wallet can in principle touch it, and lending against it can be done by a smart contract instead of a credit desk. That is the appeal: instant, programmable, no paperwork.
And then reality shows up. The share only trades on weekdays, in exchange hours. Only some people are allowed to hold the token. The borrower wants euros in an account, not a stablecoin in a wallet. And the lender needs to be able to sell the collateral at 3am on a Sunday without breaking any of those rules. A lending protocol does none of that for you. It handles collateral, debt and liquidation, and that's all.
The whole loop
Before any contract, I drew the loop: eight events, from issuing the token to closing the loan, across four layers. Two events are where a price is not enough: funding the euros, and a forced sale. For the first you need euros, for the second you need a buyer.
What I built
One unmodified Morpho Blue, pinned to a commit, with two markets on it: a crypto asset that trades 24/7 and a token that tracks a weekday-only index ETF. Loan-to-value limit is 65%. A separate creditor account supplies the euros, so the operator is not the lender.
Around it, everything the protocol doesn't know about: a gateway the customer goes through, an identity registry, a euro ledger, an oracle that knows whether the market is open, and a funded overnight bid. On top, a phone-sized customer app, and an operator desk that can move prices, switch sessions and push a loan toward liquidation so you can watch it happen instead of reading about it.
Designing the protocol side
What does the price do at night?
The share is closed, the token isn't. My first rule was the obvious one: no bid overnight, price goes to zero. That doesn't work, because a zero price breaks the liquidation math. What I ended up with: while the market is closed, new borrowing is refused, the oracle price is discounted, and a funded overnight bid caps the price a liquidation can see. If nobody has posted a bid, a sale simply fails and the loan stays open. Someone has to carry that gap, and in this design it's the lender, which means it should be priced.
Who can hold the token, and who can liquidate it?
If the token checks every recipient, then a liquidation is also a transfer that gets checked. Morpho sends the seized collateral to whoever calls the liquidation, so for the restricted token the liquidator has to be approved, or there has to be a defined route to an approved buyer. The crypto asset has no such restriction and anyone can liquidate it. The two markets behave differently on purpose, and the tests cover both the approved and the refused case.
The gateway is not a wall
I put a gateway in front of Morpho that enforces the product rules: no loans while the market is closed, nothing above 40% of value. Then I wrote the test that borrows directly on Morpho and skips it. It works. I left it in. The gateway is the product path, not a boundary, and the honest thing is to say so up front.
You don't control the seizure
Morpho decides how much collateral a liquidation takes, including the liquidator's bonus. My overnight cap constrains the price, but it doesn't touch that bonus. So it's a guard rail, not a guarantee, and the limitations page says that.
Designing the app side
Say it in plain words, not a health factor
Nobody outside DeFi knows what a health factor of 1.12 means. So the customer never sees one. They get a balance, an amount to borrow and a price chart with two lines on it: the price where you get a warning and the price where the collateral can be sold. A new loan stops at 40% of the published price. Once a loan is open, one number carries the state: current loan-to-value, with a label that reads "inside the limit", "warning" at 55% or "can be sold" at 65%, and a banner on every screen when it changes. Under it, in euros: the loan, the collateral, the interest and the margin a sale would charge. The hard part wasn't drawing it. It was making those thresholds mean exactly the same thing in the oracle, the gateway and the screen.
A euro on a chain is not a euro in an account
The market lends a euro stablecoin. The customer expects euros in their account. In between sits a small ledger with two rules: an operation that is repeated never credits twice, and a failed posting sets a flag for compensation instead of raising the balance. Boring contract, and the one that decides whether support has a bad week.
What happens when verification lapses?
A borrower's verification can expire while a loan is open. Paying the loan off still clears the debt, and the shares go to the protocol account instead of to a wallet that's no longer allowed to hold them. The token itself makes no exception to its own rule. A compliance lapse should never trap someone's debt, and it also shouldn't quietly bend the transfer rule to fix it.
Seeing it work
The demo runs in five steps: issue an asset, fund the lenders, buy as the customer, borrow, then trigger a liquidation from the desk. You can get to a forced sale in about two minutes.
The demo is public: broker-app-jade.vercel.app. It runs on a public testnet with demo tokens, so you can sign in, buy, borrow, and push your own loan to the warning and sale lines from the desk. Nothing in it is real money.
Slides and summary
- Slides (PDF, 8 pages): the staged design, the market-hours rule, who can hold and liquidate, the build, the customer screens and the path to production.
- Two-page summary (PDF).
- System map (PNG).
What this is and isn't
- Testnet only. The tokens are demo ERC-20s, not securities, and nobody issues them.
- The euro balances are a contract ledger, not a bank payment. No real money moves.
- The 5% interest rate, the prices and the weekend discounts are placeholders, not calibrated.
- No audit and no legal review. None of this is legal advice.
- The contracts have 18 passing tests. A full end-to-end smoke test on the public testnet deployment is still open.