QUANTUM BLOCKSOFTWARE
Client login Talk to us
← Back to our work
CASE STUDY · MZF PROTOCOL

Venture debt for web3 projects, written as smart contracts.

MZF Protocol lends USDC to web3 projects against milestones. Lenders pool capital in a master vault or back a single deal directly, and the contracts handle funding, releases, repayments and a set plan for loans that go wrong.

Built · pre-audit · not yet deployed Hyperliquid HyperEVM Solidity 0.8.28 · OpenZeppelin 5 · Foundry 20 contracts · ~4,800 lines 218 tests Next.js dApp
MZF dApp · overview
MZF Protocol dApp overview screen design
Product design for the investor dApp. All figures are example data.
THE PROBLEM

Projects need capital before their token. Lenders need protection.

Web3 teams often need funding before they have revenue or a token to sell, and equity rounds dilute them. Lenders who would fund them want the protections of venture debt: milestones, covenants, warrants and a clear path when a borrower falls behind.

On-chain credit has a mixed record, mostly because defaults were handled by hand and late. MZF writes the whole life of a loan into contracts, from the proposal to the workout, so lenders can see in advance exactly what happens to their money in each case.

THE RAILS

How a loan moves through the protocol

Every step below is a contract call. Off-chain due diligence feeds the decision; the money only moves on-chain.

01

Propose with a stake

Whoever proposes a deal stakes $MZF, sized by the loan. A committee approves it, or it goes live by itself after a challenge window. The stake is held for the life of the loan.

02

Fund the sub-vault

Each deal gets its own sub-vault. Direct lenders lock USDC and receive a transferable receipt; the master vault tops up the rest within its per-deal and buffer limits.

03

Release and repay

USDC goes to the borrower milestone by milestone. Repayments pay interest first, then principal and fees, split pro rata between direct lenders and the master vault.

04

Close or work out

A repaid loan returns the proposer's stake. A loan in trouble enters the workout protocol below, and if lenders lose money the stake is slashed and paid to them.

THE PRODUCT

Designed screen by screen, desktop and mobile

We designed about 50 screens before writing the app, then built them on the contracts. These are from the design canvas, with example data.

MZF master vault screen design
Master vault. Deposit USDC for shares; withdrawals are requested and settle the next day, so the vault can keep capital lent out.
MZF sub-vault detail screen design
Sub-vault. One deal's terms, milestones, documents and activity, with direct funding for lenders who want that deal's higher yield.
MZF propose-a-vault wizard design
Propose a vault. A five-step wizard; milestone tranches must add up to the target before the proposal can be submitted.
MZF token bridge screen design
Bridge. The $MZF token lives on Base; a LayerZero bridge locks it there and mints it one-for-one on HyperEVM.
WHEN A DEAL GOES WRONG

A workout protocol on timers

Each loan carries a payment schedule. Anyone can advance its stage once a deadline passes, so nobody has to decide when a borrower is in trouble.

Performing
Payments on schedule.
Watch
A payment is missed. 7-day grace period.
Standstill
30 days. The default rate agreed at origination switches on.
Workout
30 days to elect an extension or a conversion from pre-agreed ladders.
Resolved
Cured, or defaulted with recovery under way.
Resolvers. Staked specialists bid to run a recovery; lenders vote with their capital, and the winner is paid only on what it recovers.
Receipt auction. Lenders who want out can sell their position in a descending-price auction, with a reserve pool as the floor bidder.
Rescue vault. A resolver can buy a distressed deal outright and manage it out; lenders who stay convert at full face value.
INSIDE THE CODE

Built to be audited

The contracts have had an internal security review and are being prepared for an external audit. They are not deployed yet.

CONTRACTS
  • ERC-4626 master vault with a share offset against inflation attacks
  • Sub-vaults, factory and proposal registry
  • Workout, resolver, auction and rescue modules
  • Staking, vesting, treasury and reserve pool
  • LayerZero bridge pair
GOVERNANCE AND SAFETY
  • Every upgrade and role change goes through a 48-hour timelock
  • Separate roles for payments, treasury, compliance and pausing
  • KYC allowlist on deposits and transfers
  • Rolling spend caps on the treasury and reserve
TESTS
  • 218 unit, fuzz and invariant tests in Foundry
  • Invariants such as "the contract always holds what it owes"
  • A full-protocol integration test run under the real timelock
  • CI on every push
APP AND DILIGENCE
  • Next.js 15 site and dApp on wagmi and viem
  • A due diligence desk: document uploads, a 300-item risk register and AI-assisted analysis, with scoring done in code
MZFMasterVault.sol · T+1 redemption queue (trimmed)
// Instant exits are switched off: capital is lent out to deals
function withdraw(uint256, address, address) public pure override returns (uint256) {
    revert SyncWithdrawDisabled();
}

// Escrow the shares and queue them for the first UTC midnight a day away
function requestRedeem(uint256 shares) external whenNotPaused nonReentrant returns (uint256 id) {
    _transfer(msg.sender, address(this), shares);
    uint64 eligibleAt = (((block.timestamp / EPOCH) + 2) * EPOCH).toUint64();
    _queue.push(Request({ owner: msg.sender, shares: shares.toUint128(), eligibleAt: eligibleAt, settled: false }));
}

// Anyone can settle: first in, first out, while idle USDC covers the next request
while (settled < maxRequests && head < _queue.length) {
    Request storage r = _queue[head];
    if (block.timestamp < r.eligibleAt) break;
    uint256 assets = previewRedeem(r.shares);
    if (assets > available) break;
    _burn(address(this), r.shares);
    IERC20(asset()).safeTransfer(r.owner, assets);
}
Withdrawals pay at the share price on the day they settle, so a lender who leaves cannot jump ahead of a loss or a gain that the remaining lenders share.
WHAT IT MEANS FOR YOUR PRODUCT

The same skills, applied to your build

Lending and investment products

Pooled and direct funding, tranches, interest waterfalls, fees and redemption queues.

Investor and client portals

Positions, claims, documents and onboarding, designed for desktop and mobile together.

Compliance-aware design

Allowlists, role separation, timelocked changes and spend caps built in from the first contract.

Security and audit readiness

Fuzz and invariant testing, internal review and an audit-prep list before code goes to auditors.

Building something that moves money?

Tell us what you're building and we'll come back with how we'd approach it.

Talk to us Visit mzfprotocol.xyz ↗

CONTACT

Talk to us

Tell us what you are building. Email us from whichever app you use.

info@quantumblock.xyz

Open a new email in

Email app Gmail Outlook

Or call Jerome on +61 455 063 671