
Tegata
Invoices tokenized and sold for JPYC on Uniswap v4, priced on the debtor's credit curve.
Demo
About
Japan is phasing out paper promissory notes (手形). Most banks stop issuing them after September 30, 2026, and since January 2026 companies can no longer pay subcontractors with them. Small suppliers lose their usual way to get paid early, and factoring fees are often not disclosed. Tegata puts that flow on-chain. A supplier registers an invoice. The debtor accepts it, which mints tokens equal to the face value (1 token = ¥1). The supplier can sell those tokens for JPYC right away in a Uniswap v4 pool. At maturity the debtor pays in JPYC and holders redeem 1:1. If the invoice is still unpaid 3 days after maturity, anyone can mark it defaulted, and holders get a pro-rata share of what was paid plus the debtor's seized collateral. Nobody negotiates the price. A Uniswap v4 hook keeps every trade within 2% of a fair-value curve set by the debtor's credit: an operator grade plus its on-chain payment history. A downgrade or a default reprices all of that debtor's invoices at once. Unrated debtors are priced at the weakest grade and must lock 20% collateral before they can accept an invoice. The same PDF can't be financed twice by the same supplier and debtor. The dashboard has an AI operations desk that runs Claude Code with read-only tools over the live contracts, so an operator can ask which invoice needs attention and get an answer from real chain data.
How it's made
Japanese invoice becomes an ERC-20 when the buyer approves it. InvoiceRegistry deploys a fresh token when the supplier registers an invoice, then mints 1 token per ¥1 of face value to the supplier once the buyer approves. Each document hash is stored, so the same invoice can't be financed twice. Those tokens trade in Uniswap v4 pools guarded by our hook, MaturityCurveHook, on beforeInitialize, beforeSwap and afterSwap. The registry publishes a fair-value curve for each invoice: face value discounted at the buyer's current rate, rising to 1.00 at maturity. A pool has to open on that curve. Trading closes one day before maturity. Every swap must end within 2% of the curve, or move the price back toward it. So a supplier can't be dumped on at a predatory discount, and nobody can pump an invoice above what it will pay out. Uniswap v4 reads a hook's permissions from its address bits, so the deploy script uses HookMiner to find a CREATE2 salt that gives the right address. TegataMarket adds bid ladders and buy/sell helpers with slippage limits. Uniswap's own Universal Router works on the same pools, because the hook applies to every swap no matter who routes it. CreditRiskModel prices each buyer: base rate plus a grade spread, plus penalties for late payments and defaults, minus credit for on-time payments and posted collateral. New companies with no rating are priced as the worst grade and have to lock 20% collateral before they can approve an invoice. CollateralVault keeps the part of that collateral that backs unpaid invoices locked, pays APR on it from a reward pool the operator funds, and gives it to token holders if the buyer defaults. Everything settles in real JPYC on Sepolia, from JPYC Inc.'s faucet. Curvegrid MultiBaas does the indexing. Each contract is linked under a named alias. The receivables book and an event explorer page read everything through Event Queries, never by scanning logs over RPC. Queries return at most 50 rows, so we page through them. Operator actions (rating buyers, setting collateral APR, freezing an invoice) are built by MultiBaas, signed locally with the operator key, and submitted back through it. A webhook receiver checks the MultiBaas HMAC signature and links each new invoice token as it's registered. The frontend is React, Vite and viem on Vercel. The MultiBaas API key never reaches the browser. Queries go through a small Vercel function that only allows read-only Event Queries. World ID Selfie Check signs its requests on the server too, and the verified score caps how much of an invoice a consumer can sell early. Public Sepolia RPCs kept rate-limiting us, so reads batch through multicall with fallback across three providers. The AI ops desk runs the Claude Code CLI with an MCP server we wrote, which exposes four read-only chain queries. File access, the shell and the user's other connectors are all switched off, and it runs outside the repo, so it can't read our .env. It suggests actions, but every transaction still goes through the user's wallet. Replies stream to the browser as server-sent events. The contracts are Solidity 0.8.26 with Foundry, covered by 94 tests. One suite is adversarial: we tried to break our own contracts, fixed what broke, and left tests that document the attacks still possible. Another runs on a fork of Sepolia against the real PoolManager, Universal Router and JPYC.