# Escrow events (/docs/developers/escrow-events) Every order's life on QIE as events you can index yourself. Ids and amounts only, never a phone number, meter or name. Anyone can follow Todoku on the explorer or index the escrow. Order and pot ids are 32 random bytes; nothing personal goes on chain. | Event | Fields (`indexed` marked) | | --- | --- | | `OrderPaid` | `bytes32 indexed orderId, address indexed payer, uint256 amount, uint8 asset` | | `PaymentReceived` | `address indexed payer, uint8 asset, uint256 totalQusdc, uint256 qieSpent` | | `OrderReleased` | `bytes32 indexed orderId, uint256 amount` | | `OrderRefunded` | `bytes32 indexed orderId, address indexed to, uint256 amount, uint8 reason` | | `OrderRefundedToPot` | `bytes32 indexed orderId, bytes32 indexed potId, uint256 amount, uint8 reason` | | `OrderReclaimed` | `bytes32 indexed orderId, address indexed to, uint256 amount` | | `PotFunded` | `bytes32 indexed potId, address indexed funder, uint256 amount, uint256 endsAt, uint8 asset` | | `PotOrderCreated` | `bytes32 indexed potId, bytes32 indexed orderId, uint256 amount` | | `PotReclaimed` | `bytes32 indexed potId, address indexed funder, uint256 amount` | | `TreasuryUpdated`, `QuoteSignerUpdated`, `LimitsUpdated`, `ExcessSwept` | Admin changes | Amounts are QUSDC with 6 decimals. `asset` is 0 for QUSDC, 1 for QIE. Refund reasons are listed on the [status map](/docs/developers/status-map#refund-reasons-on-chain). ## Read an order [#read-an-order] ```ts title="watch-escrow.ts" import { createPublicClient, http, parseAbiItem } from "viem"; const escrow = "0x…"; // TodokuEscrow, see QIE → Addresses const client = createPublicClient({ transport: http("https://rpc5mainnet.qie.digital") }); // Status: 0 None, 1 Held, 2 Released, 3 Refunded, 4 Reclaimed const order = await client.readContract({ address: escrow, abi: [parseAbiItem("function getOrder(bytes32) view returns ((address payer, uint56 amount, uint32 paidAt, uint8 status))")], functionName: "getOrder", args: ["0x…orderId"], }); // Every release in a block range (QIE nodes answer up to 10,000 blocks per call) const released = await client.getLogs({ address: escrow, event: parseAbiItem("event OrderReleased(bytes32 indexed orderId, uint256 amount)"), fromBlock: 0n, toBlock: 9_000n, }); ``` `solvency()` returns the escrow's QUSDC balance and what it owes (held orders plus pot balances); the contract never pays out below what it owes (tested as an invariant); only an outside QUSDC burn could break that (see [Risks](/docs/trust/risks)). ## The price signature [#the-price-signature] Todoku's quote key signs, and the contract checks, this EIP-712 message: ```text Domain: name "TodokuEscrow", version "1", chainId 1990, verifyingContract = the escrow Quote: Quote(address payer, bytes32[] orderIds, uint256[] amounts, uint256 expiry) PotQuote: PotQuote(bytes32 potId, address funder, uint256 amount, uint256 perClaim, uint256 endsAt, uint256 expiry) ``` Drop claims are signed by the claimer, off chain, and checked by Todoku: domain `{ name: "Todoku", version: "1", chainId }`, `DropClaim(string drop, string phone, address wallet, uint256 issuedAt)`, valid for 10 minutes. # HTTP API (/docs/developers/http-api) The routes behind the app. Public reads need nothing; private ones need the wallet's sign-in cookie; a few are operator-only. **Auth:** none · **SIWE** (the `todoku_session` cookie from signing in with your wallet) · **ops** (SIWE plus an operator wallet) · **bearer** (an AI app's token). ## Public [#public] | Method and path | What it returns | | --- | --- | | `GET /api/health` | Database and worker heartbeat | | `GET /api/contracts` | This deployment's network, escrow and naira feed addresses (null until deployed) | | `GET /api/prices` | Naira per dollar (before the margin) and QIE in dollars, cached 30 s | | `GET /api/plans?service=` | Live data, TV and exam plans, cheapest first | | `POST /api/verify` | A meter, smartcard or JAMB code checked by name (masked when signed out); 30 a minute | | `POST /api/quotes` | Price and sign one order; 30 a minute per IP | | `GET /api/orders/{id}` | One order's status, by its id (no full number, no token) | | `POST /api/orders/{id}/tx` | "I paid": the web app reads that transaction's receipt at once and applies its escrow events | | `GET /api/receipts/{slug}/card` | The receipt's share image | | `GET /api/identity/{address}` | QIE ID name, paid and verified | | `GET /api/demo-line` | The demo line's network and last four digits | | `GET, POST /api/pay-links[/{id}]` | Make or read a pay link (10 per 10 minutes per IP) | | `GET /api/shops/{handle}` | A shop's page data | | `GET /api/swap`, `GET /api/loan` | A QUSDC → QIE swap transaction; a QIELend borrow plan (mainnet) | | `GET /api/search` | Docs search | ## Signed in (SIWE) [#signed-in-siwe] `/api/auth/nonce`, `/verify`, `/me`, `/logout` · `GET /api/orders` (history) and `/api/orders/export` (CSV) · `GET /api/orders/{id}/secret` (token or PINs, payer only) · tickets · saved numbers and `/api/prefill` · `/api/rewards` · `/api/quotes/bulk` (shops, 20 lines) · `/api/agent/*` · `/api/drops` (create, quote) · `/api/telegram` · `/api/account/connections`. Drop claims (`POST /api/drops/{id}/claim`) use the claimer's typed signature instead of a session. ## Operators [#operators] `/api/ops/overview`, `/switches`, `/orders/{id}` (ask again, refund, mark delivered), `/agents` (suspend, reinstate). ## Webhooks [#webhooks] | Route | Trust | | --- | --- | | `POST /api/webhooks/vtpass` | VTpass doesn't sign, so the body is only a hint: it is stored with tokens removed, acknowledged, and Todoku asks VTpass itself | | `POST /api/webhooks/fonbnk` | The signature is checked on the raw body before anything else | Both are de-duplicated by the body's SHA-256. MCP and OAuth routes are on their own pages. There is no public JSON for the scorecard: it is a page, [/scorecard](/scorecard). For AI readers, every docs page is also Markdown at `/docs/.md`, with [/llms.txt](/llms.txt) and [/llms-full.txt](/llms-full.txt). # Architecture (/docs/developers) One Next.js app, one worker, one Postgres, one escrow on QIE. Every way in, from the website to an AI chat, goes through the same order service. | Part | What it is | What it does | | --- | --- | --- | | **Web app** | Next.js 16 (React 19, wagmi 3, viem, TanStack Query) | Pay screens, receipts, the scorecard, the docs, the HTTP API and the MCP endpoint. Signs prices with the quote key, which can't move money | | **Worker** | The same code bundled for Node, pg-boss jobs | Reads every escrow event, buys bills, asks providers again, releases and refunds, pays rewards, publishes the rate, sends Telegram notices | | **Postgres** | Drizzle | Orders and their events, deliveries, chain events with the indexer's cursor, jobs. Phone, meter and smartcard numbers are encrypted | | **TodokuEscrow** | Solidity, on QIE mainnet at [`0x2a2f…E2a5`](https://mainnet.qie.digital/address/0x2a2fD1193f51Bca1ABF85012316F3e835E6eE2a5) (production) and [`0xff54…a783`](https://mainnet.qie.digital/address/0xff54634a5f27D7770Cd4C63dff46D3b0dce6a783) (staging), verified | Holds each payment until release, refund or reclaim | | **FiatRateFeed** | Solidity, on QIE mainnet at [`0xd978…934a`](https://mainnet.qie.digital/address/0xd97837d5f7E0aAD0648E262FA0d374Ef9756934a), verified | Todoku's naira rate, public once deployed | ## One order service [#one-order-service] The website, shops, bulk sales, pay links, the demo line and the MCP endpoint all price through one function; drops are priced by their own pot quote: the switches and the daily cap at funding, the switches and the provider float at each claim. Every price runs the same checks: kill switches, the provider's float, the per-order and daily caps, the duplicate and in-flight guard, the rate snapshot, the QIEDEX quote, then the EIP-712 signature. The prices, limits and rewards tier in force are stored on the order. ## Moving money safely [#moving-money-safely] - **Chain events decide.** Only an escrow event moves an order into Held, Released, Refunded or Reclaimed. When the app says "I paid", the web app reads that transaction's receipt and applies its escrow events at once; the indexer sees them again later. - **Every state change is guarded twice**: `UPDATE … WHERE status = from` in code, and a database trigger with the allowed-transition table. - **The provider's answer decides delivery.** Webhooks only trigger a fresh question to the provider. - **Every transaction is stored before it is sent**, one signer at a time, and re-sent after a crash. # MCP endpoint (/docs/developers/mcp) Eight tools at mcp.todokupay.xyz/mcp that let any AI app price bills, make pay links and follow orders, with a card that renders in the chat. It never holds keys. ```text https://mcp.todokupay.xyz/mcp ``` Streamable HTTP, stateless (a fresh server per request), JSON responses, CORS open. Server name `todoku`, title "Todoku", with the Todoku icon at 512 and 192 pixels. ## Tools [#tools] | Tool | Inputs | Returns | Sign-in | | --- | --- | --- | --- | | `list_services` | `kind?`, `serviceId?` | Services, minimums, and plans for one service (up to 60) | No | | `verify_recipient` | `serviceId`, `recipient`, `meterType?`, `planCode?` | Masked holder name, can pay, minimum, owed, due date, bouquet, renewal price | No | | `quote` | `serviceId`, `recipient?`, `amountNaira?`, `planCode?`, `meterType?`, `subscriptionType?`, `quantity?`, `contactPhone?`, `confirmRepeat?`, `savedRecipientId?`, `note?`, `payer?`, `asset?` | Without `payer`: a **pay link** open 72 hours, with the card. With `payer`: the **unsigned transactions** for that wallet to sign within about a minute | Only with `savedRecipientId` | | `order_status` | `orderId?` or `payLinkId?` | Where it stands, with transaction links and the card. Never a token or PIN | No | | `update_bill` | `payLinkId`, `editKey`, `amountNaira?`, `recipient?`, `planCode?`, `note?` | A replaced link. Called by the card only | Card's edit key | | `cancel_bill` | `payLinkId`, `editKey?` | The link, cancelled | Edit key, or the signed-in person who asked | | `my_orders` | `limit?` (up to 20), `filter?` | Your latest orders | Yes | | `my_recipients` | none | Your saved numbers, last digits only | Yes | Personal tools answer HTTP **401** with a `WWW-Authenticate` header pointing at Todoku's resource metadata, which starts the AI app's sign-in ([AI app sign-in](/docs/developers/oauth)). Public tools never ask. ## The card [#the-card] `quote`, `order_status` and `cancel_bill` carry an MCP Apps card: the resource `ui://todoku/bill-card-v1.html` (`text/html;profile=mcp-app`), linked through `_meta.ui.resourceUri` and the older aliases. It shows the biller's logo, the number's last digits, the amount, the note, a QR of the pay link, **Open to pay**, **Copy link**, **Edit** and **Cancel**, then polls `order_status` (every 6 seconds for 3 minutes, every 15 seconds to 20 minutes, every 45 seconds to 2 hours) until **Delivered** with **View receipt**, or **Refunded**. Apps without cards get the same facts as text. The edit key that lets the card change its own link is returned in the result's `_meta`, never in the text the model reads. ## Limits [#limits] | | | | --- | --- | | Per IP | 1,500 requests a minute before anything runs | | Per caller | 300 a minute (or 120 per signed-in wallet); status checks have their own 600 | | `verify_recipient`, `quote` | 10 a minute per caller, 60 a minute in all | | Quotes for one named payer | 2 a minute | | Off switch | `surface:mcp` stops the whole endpoint (503) | ## It can't spend [#it-cant-spend] Todoku holds no user keys. A pay link is paid by a person in their own wallet; unsigned transactions are signed by the wallet named as `payer`. The sign-in gives an app your orders and saved numbers, never the power to pay. # AI app sign-in (/docs/developers/oauth) Todoku is its own OAuth 2.1 server. The person signs one wallet message on todokupay.xyz; the AI app gets a token for mcp.todokupay.xyz/mcp that can read your orders and make pay links in your name, never pay. | Endpoint | Path | | --- | --- | | Protected resource metadata (RFC 9728) | `https://mcp.todokupay.xyz/.well-known/oauth-protected-resource/mcp` | | Authorization server metadata (RFC 8414) | `/.well-known/oauth-authorization-server` | | Authorize | `/oauth/authorize` → the consent page `/oauth/connect` | | Token | `POST /api/oauth/token` | | Register (RFC 7591) | `POST /api/oauth/register` | | Revoke (RFC 7009) | `POST /api/oauth/revoke` | ## The flow [#the-flow] 1. A personal tool answers 401. The app reads the resource metadata, then the server metadata. 2. **Client**: apps with a client metadata document (CIMD) from claude.ai, claude.com or chatgpt.com are fetched and trusted by host; any other app registers itself (dynamic registration) and is shown as "(unverified)". 3. **Authorize**: code flow only, PKCE S256 only, the `resource` must be `https://mcp.todokupay.xyz/mcp`, scope `account`. Todoku's consent page names the app and where it sends you back. 4. **Consent**: the wallet signs one sign-in message that names the app and says it can't move money. The page checks the request's origin and a cookie set for that one request. 5. **Tokens**: a single-use code (60 seconds) for an access token (1 hour) and a refresh token (30 days, replaced on every use). Reusing a code, or an old refresh token after a 30-second grace, revokes the whole grant. Only SHA-256 hashes of tokens are stored. ## The rules [#the-rules] - The consent page can't be framed by another site. - A redirect must match exactly; a loopback address may use any port. - The person can disconnect any app in **Account → AI apps**, which revokes the grant and every token. - `surface:mcp_auth` stops new sign-ins. # One payment, end to end (/docs/developers/payment-flow) From a signed price to a release on QIE, with the real timings of a test-build order and every place it can turn into a refund. ### Price [#price] `POST /api/quotes` checks the bill and the limits, converts naira to QUSDC at the reference rate less 1%, asks QIEDEX for an exact-out quote when paying in QIE, stores the order as `quoted` with a random 32-byte order id, and signs `Quote(payer, orderIds, amounts, expiry)` with EIP-712. The price expires in 60 seconds, which is also the swap's deadline. ### Pay [#pay] The wallet simulates, then sends `payWithQIE(quote, sig)` with the "at most" QIE as value (gas limit = estimate × 1.2), or approves and sends `payWithQUSDC`. The app posts the transaction hash to `POST /api/orders/{id}/tx` at once and polls the order every 2 seconds. ### Held [#held] The escrow emits `OrderPaid(orderId, payer, amount, asset)`. The indexer (every 4 seconds) or the fast path reads it, checks the payer and amount match the stored order, and moves it to `held`. That queues a `delivery.vend` job. ### Buy [#buy] The worker writes a request id (Lagos `YYYYMMDDHHmm` + 12 random characters) and a dispatch stamp **before** calling VTpass, then calls `pay` once. It never retries a purchase blindly: an unclear answer becomes a requery. ### Settle [#settle] Delivered → `release(orderId)`; failed → `refund(orderId, reason)`. Both go through the operator's signing lane, which first reads the order on chain to confirm it is still Held, stores the signed transaction, then broadcasts. `OrderReleased` or `OrderRefunded` moves the order to `released` or `refunded`. ### After [#after] Released orders pay cashback and invite rewards; Telegram sends the notice. If nothing settles, the payer can `reclaim` after the delay. ## Where it can turn [#where-it-can-turn] | Moment | What happens | | --- | --- | | Price expires before payment | Order `expired`. A late `OrderPaid` before the on-chain expiry still counts | | Provider closed, paused or out of float | Fails before buying, refunded | | Provider says failed or reversed | Refunded, reason code on chain | | Provider unsure | Asked again after 15 s, then 1 min later, 5 min later, then every 15 min; after 24 h, `needs_review` for an operator | | Delivered after a refund | `delivered_after_refund`: the payer keeps the bill and the money; Todoku logs the loss | | Nobody settles | The payer reclaims after `RECLAIM_DELAY` | # Bill providers (/docs/developers/providers) VTpass sells Nigeria's bills; Fonbnk is built for Kenya and Ghana airtime and switched off. Only the provider's own answer settles an order. ## VTpass (Nigeria) [#vtpass-nigeria] Airtime, data, electricity, TV and exam PINs. Before buying, Todoku stores the request id (Lagos `YYYYMMDDHHmm` + 12 random characters) and the dispatch time; it calls `pay` once and never repeats it blindly. A second purchase to the same biller account within 31 seconds waits for the gap to pass. | VTpass answers | Todoku does | | --- | --- | | Delivered (`000`), with a token or PINs when the product has them | **Delivered** → release | | `016` or failed | **Failed** → refund | | `091` (not processed) | **Failed** → refund | | `040` or reversed | **Failed** → refund (reason 2) | | `013` / `017` (below minimum / above maximum), account and request errors, biller down | **Failed** → refund | | `018` (Todoku's float is empty) | Refund if it was the purchase; the float breaker closes the provider | | `015` (no record) | Pending; **failed** once the request id's Lagos day has passed | | `019` (repeat within the window) | Nothing bought: retried with a fresh request id for up to 15 minutes, then refunded | | `099`, `089`, a timeout, anything else | **Pending** → ask again | Pending orders are asked again after 15 seconds, then 1 minute later, then 5 minutes later, then every 15 minutes. After 24 hours still pending, the order goes to an operator (`needs_review`) and keeps being asked. VTpass webhooks are only a hint to ask now. ## Fonbnk (Kenya and Ghana) [#fonbnk-kenya-and-ghana] Safaricom, Airtel and Telkom in Kenya; MTN, Telecel and AT in Ghana, paid from Todoku's merchant balance in dollars. Requests are signed with HMAC-SHA256 and webhooks are verified on the raw body. `payout_successful` releases; any `refund_*` refunds; a deposit that goes nowhere for 30 minutes fails. Fonbnk is built and tested against its documented API but switched off (`provider:fonbnk`) until Fonbnk enables order creation for Todoku's account. While it is off, the Kenya and Ghana switch doesn't appear in the app. # Run it (/docs/developers/run-it) One repository, one Dockerfile with two targets, and the settings each part needs. ## Layout [#layout] ## Local [#local] ```bash pnpm install pnpm dev # web on :3010 (builds the AI card first) pnpm dev:worker # the worker, reading .env.local pnpm test # vitest: the state machine, provider outcome maps, request ids pnpm contracts:test ``` ## Docker and Coolify [#docker-and-coolify] One image recipe, two targets: `web` (the Next.js standalone server, health at `/api/health`) and `worker` (the bundled worker, healthy while its heartbeat is fresh). Each environment (staging, production) runs a web app, a worker and its own Postgres. Deploy the worker first: it runs the migrations. ## Settings [#settings] | Group | Names | | --- | --- | | Build (public) | `NEXT_PUBLIC_APP_ENV`, `NEXT_PUBLIC_APP_URL`, `NEXT_PUBLIC_QIE_NETWORK`, `NEXT_PUBLIC_ESCROW_ADDRESS`, `NEXT_PUBLIC_TELEGRAM_BOT` | | Database | `DATABASE_URL` | | Chain | `QIE_NETWORK`, `ESCROW_ADDRESS`, `ESCROW_DEPLOY_BLOCK`, `NGN_FEED_ADDRESS` | | Keys | `QUOTE_SIGNER_KEY` (web), `OPERATOR_KEY`, `FEED_KEY`, `REWARDS_KEY` (worker) | | Secrets | `SESSION_SECRET`, `PII_ENC_KEY` | | Providers | `VTPASS_ENV`, `VTPASS_API_KEY`, `VTPASS_PUBLIC_KEY`, `VTPASS_SECRET_KEY`; the `FONBNK_*` keys | | Optional | `OPS_WALLETS`, `DEMO_LINE`, `TELEGRAM_BOT_TOKEN` | Secrets live only in the server's runtime settings, never in the repository. ## Contracts [#contracts] `contracts/script/Deploy.s.sol` deploys the escrow (limits: 100 QUSDC an order, 2,000 a payment, 5,000 a pot, 20 lines; `RECLAIM_DELAY_SECONDS` from the environment; a one-day delay on handing over the admin role) and the NGN/USD feed, and refuses any chain but 1990. They will be verified on QIE's Blockscout (`--verifier blockscout --verifier-url https://mainnet.qie.digital/api/`). # Order status map (/docs/developers/status-map) Thirteen states, the allowed moves between them, and what triggers each move. Code and database enforce the same table. | Status | The app says | Money in the escrow | Final | | --- | --- | --- | --- | | `quoted` | Confirming payment | No | | | `awaiting_payment` | Confirming payment | No | | | `held` | Delivering | Yes | | | `delivering` | Delivering | Yes | | | `needs_review` | Taking longer | Yes | | | `delivered` | Delivered | Yes, until release | | | `released` | Delivered | No, with Todoku | ✓ | | `failed` | Refunding | Yes, until refund | | | `refunded` | Refunded | No, back with the payer | ✓ | | `reclaimed` | Money taken back | No, back with the payer | ✓ | | `expired` | Not paid | Never paid | ✓ | | `reversed` | Refunding | No | | | `delivered_after_refund` | Delivered | No | ✓ | ## What moves an order [#what-moves-an-order] | Move | Trigger | | --- | --- | | → `awaiting_payment` | The app posts the payment's hash | | → `held` | `OrderPaid` on the escrow (or `PotOrderCreated` for a drop claim) | | → `expired` | Unpaid 2 minutes after the price expired | | `held` → `delivering` | The worker stamps the dispatch and calls the provider, in one step | | → `delivered` / `failed` | The provider's answer (or an operator, from `needs_review`, with evidence) | | `delivering` → `needs_review` | Still pending 24 hours after dispatch, or delivered for a different amount | | → `released` / `refunded` / `reclaimed` | `OrderReleased` / `OrderRefunded` / `OrderReclaimed` on the escrow | | `released` → `reversed` | A release landed on an order the provider had just failed | | → `delivered_after_refund` | A late "delivered" after the money went back | Every move is `UPDATE … WHERE status IN (allowed from)` plus an `order_events` row in one transaction, and a Postgres trigger refuses any move outside the table. The trigger also freezes an order's chain id, escrow, payer and amount, and a delivery's request id once it is sent. A test keeps the SQL table and the TypeScript table identical. ## Refund reasons on chain [#refund-reasons-on-chain] | Code | Meaning | | --- | --- | | 1 | The provider failed or didn't process it | | 2 | The provider reversed it | | 3 | No record after the provider's day ended | | 4 | Couldn't send: provider closed, paused, out of float, biller down, account problem | | 5 | An operator refunded it from review | # The worker (/docs/developers/worker) One background process that reads the escrow, buys bills, asks providers again, settles on chain, pays rewards and sends notices, each job safe to run twice. On start it runs the database migrations, starts pg-boss, registers the jobs, starts the escrow indexer and the Telegram bot (when configured), and writes a heartbeat every 30 seconds that `/api/health` reads. ## Jobs [#jobs] | Job | What it does | Runs | | --- | --- | --- | | `delivery.vend` | Buys the bill from the provider. Never retried by the queue | On `OrderPaid`; 4 at a time | | `delivery.requery` | Asks the provider again | On the ladder, on a webhook; 4 at a time | | `chain.operator` | `release`, `refund`, `claimFromPot`, `reclaimPot` | One at a time (one signer) | | `orders.expire` | Marks unpaid prices expired | Every minute | | `orders.sweep` | Re-sends anything stuck (a purchase, a settlement, a requery) | Every minute and at start | | `rates.refresh` | The naira rate from Paycrest, a QIE price sample | Every minute | | `float.refresh` | Provider balances; opens or closes the float breaker | Every minute | | `escrow.solvency` | Compares the escrow's balance with what it owes | Every minute | | `feed.publish` | A new naira round when needed | Every 5 minutes | | `rewards.payout` | Cashback, invite and shop rewards, gas drips, in QIE | Every minute and after each release | | `drops.tend` | Clears failed claims, sends ended pots home | Every minute | | `telegram.notify`, `telegram.reminders`, `telegram.ops` | Notices, reminders, operator alerts | On events; reminders every minute | | `oauth.purge` | Old sign-in requests, dead tokens, unused app registrations | Daily | Jobs that touch one order use a singleton key per order, so the same work can't run twice at once. ## The indexer [#the-indexer] It reads the escrow's logs every 4 seconds in windows of up to 9,000 blocks, from one RPC node per pass (rotating through the five), and writes the events and its cursor (block number and hash) in one database transaction. If a stored block's hash changes, it rewinds 100 blocks. One advisory lock keeps it to one runner. Events are processed once, in chain order. The app's "I paid" call and the operator lane's own receipts feed the same handler. ## Signing lanes [#signing-lanes] | Key | Signs | Can it move money? | | --- | --- | --- | | Quote key (web) | EIP-712 prices only | No | | Operator (worker) | `release`, `refund`, `claimFromPot`, `reclaimPot` | Only along the contract's three paths | | Feed key (worker) | Rate feed rounds | No | | Rewards (worker) | QIE transfers for rewards and gas drips, under daily caps | From its own small wallet | | Admin | Roles, limits, unpause | Never on the server | Each lane takes a database lock for its address, simulates the call, estimates gas (limit × 1.2), picks the nonce, signs, **stores the signed transaction**, then broadcasts and waits for the receipt. After a crash, stored transactions are re-sent first, oldest nonce first. A `(purpose, ref)` pair can only ever have one transaction, and before a release or refund the lane reads the order on chain to make sure it is still Held. # Account (/docs/guide/account) Your wallet and QIE ID, your daily limit, Telegram, connected AI apps, saved numbers and the theme. | Section | What it does | | --- | --- | | Wallet | Your .qie name and badges, address, wallet and network, **View on explorer**, **Disconnect** | | QIE ID | Your paid name or **Get one**; verified or **Verify**. Verified wallets can spend up to 1,000 QUSDC a day, others 300 | | Telegram | Connect the bot with a QR or a link; disconnect. Shown where the bot is set up | | AI apps | The MCP address to copy, and every connected app with **Disconnect** | | Saved numbers | Remove any (**Remove** / **Keep**) | | Appearance | Light, Dark or Auto | Connecting a wallet never needs an email or a password. Signing in is one free signature, refused if the message is older than 10 minutes, and lasts 7 days. # AI apps (/docs/guide/ai-apps) Ask Claude, ChatGPT, Codex or any MCP app for a Nigerian bill. Chat apps show a Todoku card with a QR and Open to pay that turns Delivered; terminal apps get the pay link as text. The AI can never move your money. Todoku is an MCP server. Add it to your AI app once, then ask in plain words: "Top up my mum's MTN 0803 123 4567 with ₦500". The AI prices the bill, checks the number with the provider and hands you the bill to pay. You pay in your own wallet, and the order moves to Delivered in front of you. ## Works with [#works-with] Chat apps that support MCP Apps draw the Todoku card. Every other app gets the same answers as text, with the pay link to open. ## Add Todoku to your app [#add-todoku-to-your-app] The address is the same everywhere, and your **Account** page has it with a copy button under **AI apps**: ```text https://mcp.todokupay.xyz/mcp ``` In Claude on the web or desktop, open **Settings → Connectors** and choose **Add custom connector**. Name it **Todoku** and paste the address as the server URL. Choose **Add**. In a chat, turn Todoku on from the tools menu and ask for a bill. The card shows on the web, on desktop and in the mobile app. Open **Settings → Connectors**, turn on **developer mode**, and choose **Create**. Name it **Todoku**, paste the address as the MCP server URL, and pick **OAuth** for authentication so your orders and saved numbers work. Start a chat, add Todoku from the tools menu, and ask for a bill. ```bash claude mcp add --transport http todoku https://mcp.todokupay.xyz/mcp ``` Then type `/mcp`, pick **todoku** and **Authenticate** to connect your wallet. Claude Code answers in text, with the pay link to open in your browser. ```bash codex mcp add todoku --url https://mcp.todokupay.xyz/mcp ``` Codex opens the wallet sign-in right away; `codex mcp login todoku` signs in again later. Codex answers in text, with the pay link. Add Todoku to `~/.cursor/mcp.json` (or **Settings → MCP → Add new**): ```json { "mcpServers": { "todoku": { "url": "https://mcp.todokupay.xyz/mcp" } } } ``` Add Todoku to `.vscode/mcp.json`, then press **Start** above the entry and use it from Copilot's agent mode: ```json { "servers": { "todoku": { "type": "http", "url": "https://mcp.todokupay.xyz/mcp" } } } ``` ## What you can ask [#what-you-can-ask] | Tool | What it does | Needs sign-in | | --- | --- | --- | | `list_services` | Every biller and its plans: airtime, data, power, TV, exam PINs | No | | `verify_recipient` | Checks a meter, smartcard or JAMB profile with the provider: the name, the minimum, what is owed | No | | `quote` | Prices the bill and makes a pay link (the card in chat apps) | No | | `order_status` | Follows an order to Delivered or refunded; the card updates itself | No | | `cancel_bill` | Calls off a pay link nobody has paid | No | | `my_orders` | Your recent orders and where each stands | Yes | | `my_recipients` | Your saved numbers, by label ("Mum", "Shop meter") | Yes | On the card itself: **Open to pay**, **Copy link**, **Edit** (amount, number, plan or note, before anyone pays) and **Cancel**. ## Connecting your wallet [#connecting-your-wallet] Personal questions ("my orders", "top up Mum") ask you to connect once. The AI app opens Todoku's own page, where your wallet signs one message that names the app. It costs nothing and moves nothing. What the app gets: your orders and where each stands, your saved numbers (the full number stays with Todoku), and pay links in your name. What it never gets: **it can't move money**. Every payment still needs your signature in your wallet. Disconnect any app in **Account → AI apps**. ## Agents with their own wallet [#agents-with-their-own-wallet] An agent that controls its own wallet can pass `payer` to `quote` and get the unsigned transaction to sign within the price's 60 seconds, instead of a link. The escrow, the caps and the refund rules are the same as for a person. Details in [MCP endpoint](/docs/developers/mcp) and [AI app sign-in](/docs/developers/oauth). # Airtime and data (/docs/guide/airtime-and-data) Type the number, Todoku finds the network, then pick an amount or a live data plan. ## The number [#the-number] Type the 11-digit number. Todoku reads its first four digits and shows the network chip (MTN, Airtel, Glo or T2). Ported a number? Pick the network it is on now under **Network**: the label then reads "Network · you changed it". An unknown prefix asks you to pick: "We don't know this prefix. Pick the network below." Once you have saved numbers, they appear as chips under the field. ## Airtime [#airtime] | | | | --- | --- | | Presets | ₦100, ₦200, ₦500, ₦1,000, ₦2,000, or type any amount | | Smallest top-up | MTN ₦10 · Airtel ₦50 · Glo ₦10 · T2 ₦5 | | Largest order | About 100 QUSDC in naira (the per-order cap) | | Under the amount | What it costs in QIE right now ("≈ 2.130 QIE") | ## Data [#data] Plans come live from the provider, cheapest first, with their size and validity read from the name. Search ("2GB"), or filter **All · Daily · Weekly · Monthly · Longer**. The price is always the provider's own plan price. Bought data before? Telegram can remind you a day before a plan of two days or more runs out. See [Telegram](/docs/guide/telegram). **Next:** [Review and pay](/docs/guide/review-and-pay). # Borrow, don't sell (/docs/guide/borrow) Keep your QIE. Borrow the bill in QUSDC against it on QIELend in a few guided steps, then pay as usual. When your QUSDC is short and QIELend can lend it, the review sheet offers **Pay with a QIE-backed loan** ("Keep your QIE · x% a year on QIELend"). Todoku guides the loan; QIELend makes it; you sign every step in your wallet. Todoku never holds the loan or your collateral. ## The steps [#the-steps] A stepper walks **Wrap → Allow → Supply → Collateral → Borrow**, one signature each, skipping any step already done: | Step | What you sign | | --- | --- | | Wrap | QIE into WQIE | | Allow | Let QIELend take the WQIE | | Supply | Supply the WQIE to QIELend | | Collateral | Use WQIE as collateral | | Borrow | Borrow the QUSDC the bill needs, plus 1% (rounded up to 0.01 QUSDC) | Each step is simulated first and its result checked. If QIELend doesn't confirm a step: "Nothing moved; try again." Then the sheet switches to QUSDC ("Borrowed on QIELend. Now pay with QUSDC.") and you pay the bill as usual. ## Kept safe on purpose [#kept-safe-on-purpose] - Todoku supplies enough QIE to aim for a **health of 2** and refuses a loan under **1.5**. - It leaves 0.05 QIE in your wallet for network fees. - The sheet shows the health gauge, the borrow rate, the collateral factor, the QIE price at which QIELend would sell, the QUSDC QIELend has available, and warns when QIE's price feed is over an hour old. - It refuses when QIELend's pool is short, when borrowing is paused, or when QIELend doesn't answer. After the bill, the order page shows **Paid with a QIE-backed loan**, your loan health, and **Repay on QIELend**. QIELend lives on QIE mainnet, so the loan option is hidden on the test build. It was walked end to end on a fork of QIE mainnet; the first real-mainnet walk follows the escrow's mainnet deploy. # Airtime drops (/docs/guide/drops) Fund airtime or data for a group in one payment. Each person claims on their own number with one signature and no gas; what's left comes back to you. ## Start a drop [#start-a-drop] [New drop](/app/drops/new) (sign-in needed): | Choice | Options | | --- | --- | | What each person gets | Airtime (any network or one) or one network's data plan; ₦100, ₦200, ₦500, ₦1,000 or Other (₦50 to ₦5,000) | | How many people | 10, 25, 50, 100 or Other (1 to 500) | | Runs for | 6 hours, 1 day, 3 days or 7 days | | Who can claim | **Anyone**: one claim per phone number and per wallet · **Verified QIE IDs**: one each | Add a title and a message, then **Fund the drop**. One payment in QIE or QUSDC funds the whole pot on chain (`fundPotWithQIE` or `fundPotWithQUSDC`), and the drop opens at once. ## Claim [#claim] The claimer opens `/d/…`, connects a QIE wallet, enters their number and taps **Claim with a signature**. That signature costs nothing and moves nothing. Todoku checks the rules, then moves one claim out of the pot into a normal escrow order, so it is delivered, released or refunded like any bill. A failed claim goes back into the pot and the person can try again. First-time claimers holding less than 0.01 QIE get 0.01 QIE for gas once their airtime is delivered. ## Your drop [#your-drop] Share the link or the QR, and watch claims, deliveries and what is still in the pot. When the drop ends, Todoku calls `reclaimPot` and the rest goes back to your wallet; anyone can call it, but the money can only go to the funder. # Electricity (/docs/guide/electricity) Pick your DisCo, type the meter, see the name the DisCo has on file, then pay. The token lands on your order page. ## Pay for power [#pay-for-power] **Pick the DisCo.** **Choose your DisCo** opens all 12 with the areas they cover. Search by company or by place: "Lekki" finds Eko Electric. **Prepaid or postpaid**, then the **Meter number** (11 or 13 digits) or the **Account number** on your bill. **Where do I find it?** shows where it is printed. **The DisCo checks it.** After a short pause in typing, a card shows "IKEDC confirmed this meter" with the name, address, minimum, and any **Debt on meter** (prepaid) or amount **Owed** (postpaid). You can't continue on a number the DisCo doesn't know. **Your phone, for the SMS.** The token is also texted here and kept on your receipt. Todoku remembers it on this device. **Amount.** Presets are ₦2,000, ₦5,000, ₦10,000 and ₦20,000; the meter's own minimum applies. A prepaid meter with debt warns you that the DisCo takes it first, and a postpaid account offers **Pay ₦…** for what it owes. ## Your token [#your-token] The order page shows the token in large grouped digits with **Copy**, the units, energy bought, debt paid, tariff and the DisCo reference. Key-change codes, when a meter needs them, come first in order. The token shows to the wallet that paid, after it signs in (and, for a pay link, to the person who asked, in Telegram), and never on the public receipt. Lost it? **Find a token** at the top of the electricity screen opens your orders filtered to electricity. | DisCo | Smallest payment | | --- | --- | | Ikeja Electric (IKEDC), Aba Power | ₦100 | | Port Harcourt Electric (PHED) | ₦200 | | Kano (KEDCO), Benin (BEDC), Yola (YEDC) | ₦500 | | Abuja Electric (AEDC) | ₦900 | | Eko (EKEDC), Jos (JED), Enugu (EEDC) | ₦1,000 | | Kaduna Electric (KAEDCO) | ₦1,100 | | Ibadan Electric (IBEDC) | ₦2,000 | # Exam PINs (/docs/guide/exam-pins) WAEC result checker PINs and JAMB UTME e-PINs, kept on your order page and texted to you. | Exam | What you choose | Checks | | --- | --- | --- | | **WAEC** result checker | 1 to 10 PINs (**One fewer** / **One more**) | None needed | | **JAMB** UTME e-PIN | "UTME with mock exam" or "UTME without mock exam", and your 10-digit **JAMB profile code** | JAMB confirms the profile code by name | No profile code yet? **How do I get it?** says: text NIN followed by your NIN to 55019. Add **Your phone, for the SMS**: the PINs are texted there too. On the order page each PIN shows with its serial and **Copy**, with a reminder that each PIN works once. Like tokens, PINs show only to the paying wallet after it signs in. # Get QIE (/docs/guide/get-qie) Bridge QIE in from any EVM chain with Todoku Bridge, buy it on an exchange, or swap QUSDC for QIE on QIEDEX. You pay bills in QIE (or QUSDC), and every payment needs a little QIE for the network fee, which costs less than ₦1. **Get QIE** shows your address with a copy button and how to fill it: - **Todoku Bridge** ([bridge.todokupay.xyz](https://bridge.todokupay.xyz)) comes first. Connect any EVM wallet, pick a token you hold on Ethereum, BNB Chain, Base, Arbitrum, Optimism, Polygon or Avalanche, and it lands as native QIE at the same address. Every route is priced before you sign; Todoku takes no fee and you don't sign in. From another chain it takes two signatures: the send on your chain, then the release on QIE's own bridge (it pays only the address that signs it, so that step is always yours). When a payment says **Not enough QIE**, its **Bridge QIE in** link opens the bridge with the gap already typed in dollars. - **Buy QIE on an exchange** from [QIE's own list](https://www.qie.digital/buy) (MEXC, XT, BingX and others), then withdraw it on the QIE network to your address. Check the exchange's minimum withdrawal first. - **Or QIE Bridge, with WQIE**, with no account: buy WQIE on PancakeSwap or Uniswap ([official addresses and pools](https://www.qie.digital/wqie)), then on [QIE Bridge](https://www.bridge.qie.digital/bridge) pick **WQIE** as the asset and QIE Mainnet as the destination. It arrives as QIE: Todoku's own wallets were funded this way. Bridging BNB or ETH itself gives WBNB or WETH on QIE, which can't pay fees. - **Swap QUSDC for QIE**: if your wallet holds QUSDC, swap it on QIEDEX right there: one button: **Approve & swap** (two wallet signatures) when QIEDEX says an approval is needed, otherwise **Swap**. Home warns you when you hold less than 1 QIE ("Add a little QIE to pay a bill."). On the test build the same page offers QIE's testnet faucet and **Claim 50 tQUSDC** once an hour; those coins have no value. # Orders and saved numbers (/docs/guide/history) Every bill you paid, grouped by day, filtered in a tap, exported to CSV with its transactions. Save a number once, reuse it everywhere. **Orders** is private to your wallet, so it asks you to sign in once ("Your orders, tokens and saved numbers stay private to your wallet"). A sign-in lasts 7 days. | | | | --- | --- | | Filters | **All · In progress · Delivered · Refunded** and **All services · Airtime · Data · Electricity · TV · Exam PINs**, kept in the address so the back button works | | List | Grouped by day with the day's total, 20 at a time as you scroll | | **CSV** | Downloads every order (up to 5,000) with the Lagos date, service, masked number, plan, amount, what you paid with, status, and the payment and settlement transactions | ## Saved numbers [#saved-numbers] Save a number, meter or smartcard from its delivered order (**Save number**). Because it is saved from your own finished order, the full number never travels back up from your browser. Saved numbers show on Home, as chips on the number, meter and smartcard steps, and in **Account**; tap one to start a bill already filled in. Up to 20 per wallet. Demo-line gifts and drop claims can't be saved. # How the money moves (/docs/guide/how-it-works) Your payment waits in a contract on QIE. It can only go to Todoku after delivery, back to you, or to you again after the reclaim delay. ## The four endings [#the-four-endings] | Ending | When | Who triggers it | Where the money goes | | --- | --- | --- | --- | | **Released** | The provider confirms delivery | Todoku's operator key | Todoku's treasury | | **Refunded** | The provider fails, refuses or reverses | Todoku's operator key | Back to your wallet, in QUSDC | | **Taken back** | The reclaim delay has passed and the order is still held | You, from the order page | Back to your wallet, in QUSDC | | **Not paid** | You never paid the price | Nobody | Nothing moved | Money the escrow owes can only go to three places: Todoku's treasury, the wallet that paid, or a drop's funder. The admin can sweep only the surplus above what it owes. It is not upgradeable, so nobody can change those rules after it is deployed. ## Step by step [#step-by-step] 1. **A price, signed.** Todoku prices the bill in QUSDC and signs it (EIP-712). The price holds for 60 seconds; the sheet re-prices just before it runs out. 2. **One signature.** Paying in QIE calls `payWithQIE`: the escrow swaps on QIEDEX for the exact QUSDC the bill costs and sends any leftover QIE straight back to you. Paying in QUSDC is an approval, then `payWithQUSDC`. 3. **Held.** The escrow emits `OrderPaid`. Todoku's worker sees it within seconds and buys the bill from the provider (VTpass for Nigeria). 4. **Delivered or not.** Only the provider's answer settles it. Delivered: `release`. Failed: `refund`. Still unsure: Todoku asks again after 15 seconds, then 1 minute later, then 5 minutes later, then every 15 minutes, and after 24 hours an operator reviews it. 5. **Your fallback.** While the money is still held, the wallet that paid can call `reclaim` after the delay set in the contract when it is deployed: 24 hours planned for production, 10 minutes on the test build. The app reads the real value from the contract. The order page shows the exact time and a **Take back** button. ## What it costs [#what-it-costs] There is no fee line: the review sheet shows **Our fee ₦0**. Todoku earns the provider's commission, and it prices QUSDC at 1% under the reference rate (Paycrest's USDC to naira), so the price carries a 1% margin. Paying in QIE adds the QIEDEX swap cost, shown on the sheet as a percentage. Refunds return the full QUSDC you paid. # Introduction (/docs/guide) Buy Nigerian airtime, data, power and TV with QIE. Delivered, or your money back. Todoku lets anyone holding **QIE** pay real Nigerian bills: airtime and data on all four networks, electricity on 12 DisCos, DStv, GOtv, StarTimes and Showmax, and WAEC and JAMB PINs. You pay from your own wallet, in one signature when you pay in QIE. An escrow contract on QIE holds the money until the bill arrives, then releases it to Todoku. If the bill fails, the money goes back to you. If nobody acts at all, you can take it back yourself. Every screenshot in these docs is the real app running on a QIE test chain with VTpass's sandbox, so balances read "test QIE" and a TESTNET badge shows. On mainnet the same screens read QIE and QUSDC. The escrow is on QIE mainnet now: [Status today](/docs/trust/status) says what is live. ## What you can pay [#what-you-can-pay] | Bill | Who | You enter | | --- | --- | --- | | Airtime | MTN, Airtel, Glo, T2 (9mobile) | Phone number; the network is detected from it | | Data | The same four networks, every live plan | Phone number, then a plan | | Electricity | 12 DisCos, prepaid and postpaid | Meter or account number; the DisCo confirms the name first | | TV | DStv, GOtv, StarTimes, Showmax | Smartcard, confirmed by the provider first (Showmax: the account's phone number, not checked) | | Exam PINs | WAEC result checker, JAMB UTME e-PIN | How many PINs, or your JAMB profile code | That is 26 services from 22 billers. No sign-up, no bank account and no naira needed. ## The promise, in one picture [#the-promise-in-one-picture] ## Every way in [#every-way-in] ## Built on QIE [#built-on-qie] QIE Wallet, QIE ID, QIEDEX, QUSDC, QIELend and the QIE explorer, plus a naira rate feed Todoku publishes on QIE mainnet. [Built on QIE](/docs/qie) shows where each one works. # Ask someone to pay (/docs/guide/pay-links) Make a link for a bill, no wallet needed. Anyone opens it within 72 hours and pays with QIE. ## Make a link [#make-a-link] [Ask someone to pay](/app/ask) opens any pay screen in ask mode. Fill in the number, the plan or the meter as usual: the bill gets the same checks a payment gets (the number, the plan, the minimum, the name on a meter). Add a **Note (optional)** such as "Light for this month", then **Create pay link**. You get a QR code, the link to copy, and buttons for WhatsApp, Telegram and your phone's share sheet. The link stays open for **72 hours**. No wallet is needed to make one; signed in, the link says it comes from your name. ## Pay a link [#pay-a-link] Whoever opens `/p/…` sees "jun.qie asks you to pay" (or "Pay this bill"), the note, the bill with its confirmed name, the amount, how long is left, and one **Pay ₦…** button. They pay from their own wallet like any bill, and the money waits in the escrow the same way: "If it doesn't, the money goes back to whoever paid." - One payer at a time: while someone is paying, others see "Someone else is paying this right now". Once paid, the page shows "Paid by …" and the receipt. - With Telegram linked, the person who asked gets "🙌 … paid your bill", with the token or PINs when the bill has them. Links made from an AI app can be edited or cancelled from the Todoku card in the chat (see [AI apps](/docs/guide/ai-apps)). The website itself has no Cancel button yet; an unpaid link closes on its own after 72 hours. # Pay your first bill (/docs/guide/quickstart) Connect QIE Wallet, pick the bill, check it, sign once, and watch it arrive. ### Open Todoku and connect [#open-todoku-and-connect] Open [todokupay.xyz/app](/app). Inside QIE Wallet's browser Todoku connects on its own. On a computer, tap **Connect wallet**: QIE Wallet is listed first as "Recommended", and any other browser wallet works too. Connecting moves nothing. ### Pick the bill [#pick-the-bill] Tap **Airtime**, **Data**, **Electricity**, **TV** or **Exam PINs** under **Pay for**. Type the number: the network chip appears from the first four digits, and meters and smartcards are checked with the provider by name before you can continue. ### Review and pay [#review-and-pay] **Review payment** opens a sheet with the naira amount first, what it costs in QIE, and a 60-second hold. Choose **QIE** or **QUSDC**, then **Pay ₦…**. In QIE it is one signature. ### Watch it land [#watch-it-land] The order page updates every 2 seconds: **Paid**, **Delivered by MTN**, **Done**. **Paid** and **Done** link their transactions on the QIE explorer. If the bill fails, the money comes back to your wallet in QUSDC on its own. Paying needs only a connected wallet. Signing in (one free signature that proves the wallet is yours) is for private things: your history, electricity tokens, saved numbers and rewards. # Review and pay (/docs/guide/review-and-pay) One sheet for every bill. The naira amount first, the QIE price held for 60 seconds, and one signature. ## What the sheet shows [#what-the-sheet-shows] | Line | Meaning | | --- | --- | | The bill | Who and what: the logo, the number (or the name the provider confirmed), the plan or meter | | **Held 0:58** | The price is held for 60 seconds. Todoku re-prices 5 seconds before it runs out; if it does run out, **Get a new price** | | Our fee | ₦0. Agents see "Agent price −₦…" instead | | Swap | Paying in QIE: "QIEDEX · 0.31%", the swap's cost | | QIE back after delivery | The cashback this bill earns, paid only once it arrives (see [Rewards](/docs/guide/rewards)) | | You pay | The naira amount, then "≈ 2.152 QIE · at most 2.173": the most your wallet can be charged | | Pay with | **QIE** or **QUSDC**, each with your balance | ## Paying [#paying] - **In QIE**: one signature. The escrow swaps exactly what the bill needs on QIEDEX and sends any unused QIE straight back. - **In QUSDC**: two signatures: **Allow … QUSDC** (this order plus 3%), then **Pay ₦…**. The approval is skipped only when an earlier one still covers the bill. - The button walks you through it: "Checking…", "Confirm in wallet…", "Confirming on QIE…". You land on the order page. ## What stops a payment [#what-stops-a-payment] | You see | Why | | --- | --- | | **You just bought this** | The same amount went to this number in the last 24 hours. **Pay again anyway** if you meant it | | **An order for this number is on its way** | Another order to the same number is still being paid or delivered, whoever paid it | | **Over the limit** | 100 QUSDC per order; 300 QUSDC a day per wallet, 1,000 with a verified QIE ID | | **Not enough QIE** | Your balance is short; **Get QIE** helps. Paying in QUSDC still needs a little QIE for the network fee | | **Paused for a moment** | An operator or an automatic check paused this bill, network or provider. Nothing was taken | | **Payments aren't open yet** | This deployment has no escrow contract yet | On mainnet, when your QUSDC is short the sheet can offer **Pay with a QIE-backed loan** on QIELend. See [Borrow, don't sell](/docs/guide/borrow). # QIE back and invites (/docs/guide/rewards) Cashback in QIE on every bill that arrives, up to 2× with a verified QIE ID, and 25% of what Todoku earns on friends' bills for 180 days. ## Cashback [#cashback] Every bill that arrives pays back **25% of what Todoku earns on it**, times your QIE ID tier, in QIE: | Tier | Multiplier | | --- | --- | | Every wallet | 1× | | Premium .qie name | 1.5× | | Verified QIE ID | 2× | The tier is fixed when the price is signed, and the review sheet shows the estimate ("QIE back after delivery ≈ 0.032 QIE · 2×"). It is earned only when the order is released, never on refunds, and not on shop sales, bulk sales or drop claims. ## Invites [#invites] Share `todokupay.xyz/?ref=` with your .qie name or your 7-character code. After a friend's first bill arrives, you get 25% of what Todoku earns on their bills for 180 days. The friend sees "… invited you. You get QIE back on every bill you pay." It counts only for a wallet that has never paid before, and only if you have had a bill delivered yourself. Wallets that have funded each other don't earn from each other. A device remembers the first invite link it opens for 30 days. ## Caps [#caps] Up to ₦500 per reward on one order, ₦2,000 (and 15 QIE) per wallet a day, and ₦50,000 (and 400 QIE) a day across Todoku. Rewards are priced at whichever of QIEDEX's live QIE price and its 30-minute median gives fewer QIE, so a brief price dip can't inflate them. They are sent from Todoku's rewards wallet once enough has built up. # Sell for others (/docs/guide/shops) Shops sell airtime, data, power and TV to cash customers at the agent price, in bulk, with printed receipts and their own page. ## Open a shop [#open-a-shop] [Sell for others](/app/agent) asks for one of two things, checked again on every sale: - **A verified QIE ID**, or - **A paid .qie name**, read on chain from QIE ID. Then a shop name, an area and a shop phone (printed on receipts). **Open my shop** and your page link is made from your .qie name or the shop name. There is no waiting for approval. ## Sell [#sell] - **New sale** opens any pay screen in sale mode, with a private "Customer (only you see this)" note. You pay from your own wallet at the **agent price**: the face value minus half of Todoku's commission. On ₦1,000 of MTN airtime you keep ₦15. - **Bulk sale**: up to 20 numbers, airtime or data, in one payment at the agent price. Each number gets its own order, status and receipt; errors point to their line. - **Print**: 58 mm or 80 mm receipts with the shop's name, area and phone, the customer, the bill, its status, the token or PINs once delivered, and a QR to the public receipt. ## Your page [#your-page] Every shop gets `/a/`: the shop's name, area, its delivery record over the last 90 days, and **Buy through …**. Customers pay from their own wallets at the normal price with the same money-back promise, and the shop earns 25% of Todoku's commission on each of those bills, paid in QIE. ## The dashboard [#the-dashboard] What your wallet can still sell (it warns under ₦5,000), today's sales and what you kept by Lagos day, a 14-day chart with a table view, recent sales, your page link with what it earned, and a **Sales report (CSV)** for today, the last 14 days, this month or everything. # Telegram (/docs/guide/telegram) Delivery and refund notices with a one-tap link to your token, reminders before TV or data runs out, and pay links you can share inline. Link your wallet once in **Account → Telegram** (sign-in needed). On a computer you scan a QR; on a phone you tap a link. Telegram opens the bot, you tap **Start**, and notices arrive there. The code inside the link works once and lasts 10 minutes. ## What the bot sends [#what-the-bot-sends] | When | Message | | --- | --- | | A bill is delivered | ⚡ Token ready, 🎓 PINs ready, 📺 Subscription paid, or Delivered, as the receipt image, with **See token** (it opens your order page), **Buy again** and **⏰ Remind me** (when no automatic reminder was set) | | A bill is refunded | ↩️ Refunded: the QUSDC is back in your wallet, with **Try again** | | Someone pays your pay link | 🙌 … paid your bill, with the token or PINs in the chat when the bill has them | | TV is due | 3 days before the provider's due date, with **Renew** | | A data plan ends | 24 hours before a plan of 2 days or more runs out | | You asked to be reminded | In 3 days, a week or a month | ## Commands [#commands] `/start` · `/orders` (your last 5) · `/pay` · `/ask` (make a pay link) · `/settings` (linked wallets, disconnect) · `/help`. Type `@` and the bot's name in any chat to share one of your open pay links as a card that turns ✅ Paid when it is paid. Nothing is paid inside Telegram. **Renew** and **Buy again** open Todoku with the bill filled in, and you still review it and sign in your own wallet. Reminders are set up only when the wallet is linked at the time the bill is delivered. The production bot is [@Todoku1_bot](https://t.me/Todoku1_bot). A wallet sends to one chat; one chat can follow several wallets. Unlink from the website, from `/settings`, or by blocking the bot. # Try it from anywhere (/docs/guide/try-it) No Nigerian number needed. Gift ₦100 of airtime to the Todoku demo line and watch it land on QIE. Judges and QIE holders outside Nigeria can still see a real bill go through. **Try it from anywhere** ([/app/try](/app/try)) gifts ₦100 of airtime to the Todoku demo line, a real Nigerian SIM. It runs through the same price, caps and escrow as every other order, so you see the whole path: paid into the escrow, bought from the provider, released on QIE, and the receipt. ## How it goes [#how-it-goes] **Gift ₦100.** Connect a QIE wallet and tap **Gift ₦100**. The review sheet opens like any bill, showing the demo line only as "MTN •••• 8218" on production. **The escrow holds it.** Your one signature pays the escrow; it swaps your QIE on QIEDEX for the exact QUSDC. **Delivered, or your money back.** Delivered: released to Todoku. Failed: back to your wallet, on QIE. ## See every outcome (staging) [#see-every-outcome-staging] Where Todoku runs on VTpass's sandbox, as [staging.todokupay.xyz/app/try](https://staging.todokupay.xyz/app/try) does on its own mainnet escrow, the page also offers three test numbers, so you can watch each ending on purpose. The payment and its release or refund are real QIE transactions; the airtime is VTpass test airtime: | Card | What happens | | --- | --- | | Always delivers | Delivered, then released on QIE | | Stays pending | Watch Todoku keep asking the provider. It never settles on its own, so after the reclaim delay you can take your money back (or an operator reviews it after 24 hours) | | Always fails | Refunded in seconds, the money back on QIE | The gift button needs the escrow contract. Until it is deployed on QIE mainnet, production answers "Payments aren't open yet". One open gift per wallet at a time. # TV (/docs/guide/tv) DStv, GOtv, StarTimes and Showmax. The provider confirms the card, then you renew at its own price or pick a bouquet. | Provider | You enter | | --- | --- | | DStv, GOtv | 10-digit smartcard or IUC number | | StarTimes | 11-digit smartcard | | Showmax | The phone number on your Showmax account | After the check you see the account's status, when it runs until (or when it ended), the current bouquet and the decoder balance when the provider returns one. - **Renew**: "Renew GOtv Jolli: the same bouquet, at GOtv's price". The price is always the one the provider returns for this card. - **Or choose another bouquet**: search the provider's bouquets; the current one is marked "On this card now". One order pays one bouquet period. Longer periods are their own bouquets in the list. With Telegram linked, Todoku reminds you 3 days before the subscription is due, with a link back to this screen that fills in the card once you sign in. # Your order and receipt (/docs/guide/your-order) Live progress with every transaction, a receipt to share, the token or PINs, and the button to take your money back. ## While it runs [#while-it-runs] The page refreshes every 2 seconds until the order settles. You can leave; Todoku finishes it for you. **Updates** shows three steps: 1. **Paid**: "Held safely on QIE until it's delivered", with the payment transaction. 2. **Delivered by MTN**, or "Sending to MTN", or "Taking longer than usual", or "MTN couldn't deliver" with the reason. 3. **Done**: "The payment was released on QIE", or "Refunded to your wallet: back in QUSDC, automatically", or "You took your money back". ## The receipt [#the-receipt] A ticket with the outcome, the amount, the network or plan or meter, what you paid with, who paid, the date, the order's id on QIE, and links to the **Payment**, **Release**, **Refund** or **Reclaim** transactions. **Share receipt** shares the public receipt; **Buy again** opens the same bill filled in (exam PINs open the exam screen empty); **Save number** keeps it for next time. The public receipt has its own link image, and it is not indexed by search engines. ## Take your money back [#take-your-money-back] If an order is still held when the reclaim delay ends (planned at 24 hours on production, 10 minutes on the test build; the app reads it from the contract), the order page shows **Take your money back yourself** and a **Take back ₦…** button. It calls `reclaim` on the escrow from the wallet that paid, with no help from Todoku, and it works even if Todoku has paused the contract. Before the delay, a stuck order says when you'll be able to. ## Something wrong? [#something-wrong] Once paid, the payer can sign in and **Report a problem**: "It didn't arrive", "Wrong amount or plan", "I used the wrong number" (Todoku warns it can't pull airtime back), or "Something else". The thread sits on the order page and operators reply from the ops console. One open ticket per order. # Addresses (/docs/qie/addresses) Every QIE contract and service Todoku talks to, from its own config, with explorer links. QIE mainnet, chain id 1990 (`0x7c6`). RPC nodes `rpc1mainnet` to `rpc5mainnet.qie.digital`, used with fallback. Explorer [mainnet.qie.digital](https://mainnet.qie.digital). ## Todoku's contracts [#todokus-contracts] ## QIE contracts Todoku uses [#qie-contracts-todoku-uses] | Contract | Address | Used for | | --- | --- | --- | | QIEDEX router | [`0x08cd2e72e156D8563B4351eb4065C262A9f553Ef`](https://mainnet.qie.digital/address/0x08cd2e72e156D8563B4351eb4065C262A9f553Ef) | The swap inside every QIE payment; QUSDC → QIE on Get QIE | | WQIE | [`0x0087904D95BEe9E5F24dc8852804b547981A9139`](https://mainnet.qie.digital/address/0x0087904D95BEe9E5F24dc8852804b547981A9139) | The swap path; QIELend collateral | | QUSDC (6 decimals) | [`0x3F43DA82eC9A4f5285F10FaF1F26EcA7319E5DA5`](https://mainnet.qie.digital/address/0x3F43DA82eC9A4f5285F10FaF1F26EcA7319E5DA5) | What the escrow holds and refunds | | QIELend comptroller | [`0x69a31E3D361C69B37463aa67Ef93067dC760fBD4`](https://mainnet.qie.digital/address/0x69a31E3D361C69B37463aa67Ef93067dC760fBD4) | Collateral, loan health | | QIELend qWQIE | [`0x25A9bD97C90161A622a75A4Fd87ea0e7507324CA`](https://mainnet.qie.digital/address/0x25A9bD97C90161A622a75A4Fd87ea0e7507324CA) | Supplying QIE | | QIELend qQUSDC | [`0x3EcD3b3fa22Cc251301BA78F4Ba014f78B6FE542`](https://mainnet.qie.digital/address/0x3EcD3b3fa22Cc251301BA78F4Ba014f78B6FE542) | Borrowing QUSDC | | QIELend oracle | [`0x02D1D90247C030Cb69c6Db90e0d891d710c215E0`](https://mainnet.qie.digital/address/0x02D1D90247C030Cb69c6Db90e0d891d710c215E0) | QIE's price for loan health | | QIE Oracle QIE/USDT | [`0x3Bc617cF3A4Bb77003e4c556B87b13D556903D17`](https://mainnet.qie.digital/address/0x3Bc617cF3A4Bb77003e4c556B87b13D556903D17) | The feed's age on the loan sheet | | QIE ID Metadata | [`0xCFBcBCA93c607590b211c81C7DBcdbd7eD6CC6ED`](https://mainnet.qie.digital/address/0xCFBcBCA93c607590b211c81C7DBcdbd7eD6CC6ED) | Is this `.qie` name paid (shops) | ## QIE services [#qie-services] | Service | Address | Used for | | --- | --- | --- | | QIEDEX Swap API | `api.dex.qie.digital` | Exact-out quotes for payments; swap transactions for Get QIE | | QIE ID API | `sdk-live.qie.digital` | Names, premium names, verified status (keyless, 30 requests a minute per IP) | | QIE ID app | [id.qie.digital](https://id.qie.digital) | Get a name, verify | | Explorer API | `mainnet.qie.digital/api` | Contract verification; the "funded each other" check on invites | # The escrow contract (/docs/qie/escrow) TodokuEscrow holds every payment in QUSDC. What it owes can go only to Todoku's treasury after delivery, the payer, or a drop's funder, and it can't be upgraded. `TodokuEscrow` (Solidity 0.8.28, OpenZeppelin 5.6.1) is the promise in code. It is **not upgradeable**: no proxy, no admin who can swap the logic. Money it owes can leave to three places only: Todoku's treasury, the wallet that paid, or a drop's funder; the admin can sweep only the surplus above what it owes. ## What each function does [#what-each-function-does] | Function | Who may call it | Works while paused? | What it does | | --- | --- | --- | --- | | `payWithQIE(quote, sig)` | The payer named in the quote | No | Opens the orders as Held, swaps the QIE sent for the exact QUSDC on QIEDEX, returns leftover QIE | | `payWithQUSDC(quote, sig)` | The payer | No | Opens the orders and pulls the exact QUSDC (approve first) | | `release(orderId)` | Todoku's operator | No | Held → Released: the QUSDC goes to the treasury | | `refund(orderId, reason)` | Todoku's operator | **Yes** | Held → Refunded: back to the payer, or into the drop's pot while it runs | | `reclaim(orderId)` | **Only the payer** | **Yes** | After `RECLAIM_DELAY`: Held → Reclaimed, back to the payer | | `fundPotWithQIE` / `fundPotWithQUSDC` | The funder in the pot quote | No | Funds or tops up a drop's pot | | `claimFromPot(potId, orderId)` | Todoku's operator | No | Turns one claim into a Held order paid from the pot | | `reclaimPot(potId)` | Anyone | **Yes** | After the drop ends: what's left goes to the funder | | `pause` / `unpause` | Pauser / admin | | Stops new payments and releases; refunds and reclaims keep working | | `sweepExcess(to)` | Admin | | Moves only what the contract holds **beyond** what it owes | ## The checks on every payment [#the-checks-on-every-payment] Todoku signs each price with EIP-712 (`Quote(payer, orderIds[], amounts[], expiry)`, domain "TodokuEscrow", version 1). The contract refuses a payment when: - the caller isn't the payer in the quote, or the quote expired; - the signature isn't Todoku's quote key; - an order id was used before; - one order is over **100 QUSDC**, a payment over **2,000 QUSDC** or **20 lines**; - the QUSDC that arrived isn't exactly the total. Every order sits in one storage slot: payer, amount, paid time and status (None, Held, Released, Refunded, Reclaimed). Each one moves from Held to exactly one ending. ## Reclaim [#reclaim] `RECLAIM_DELAY` is fixed when the contract is deployed: never under 10 minutes; planned at 24 hours for production, and 10 minutes on the test build. The app reads it from the contract, so the order page always shows the real time. ## Tested [#tested] 39 Foundry tests: 25 unit tests, 4 invariants (the balance always covers what is owed; what is owed equals held orders plus pot balances; money in equals money out plus the balance; no QIE left in the contract), 4 for the rate feed, 2 on a QIE mainnet fork (pay in QIE, release; pay in QUSDC, refund on the real router, WQIE and QUSDC), and 4 for the test-chain stand-ins. Events and the full ABI: [Escrow events](/docs/developers/escrow-events). # Built on QIE (/docs/qie) QIE Wallet to pay, QIEDEX to swap, QUSDC to hold, QIE ID for names and tiers, QIELend to borrow, and a contract on QIE that keeps the promise. | QIE piece | What Todoku does with it | Where you see it | | --- | --- | --- | | **QIE chain** (mainnet, chain 1990) | Where the escrow runs (deployed 25 November 2026); you pay and get refunds on it | Payment, release, refund and reclaim links on every receipt | | **QIE coin** | What you pay with, and what cashback is paid in | The QIE price under every amount; **QIE back** | | **[QIE Wallet](/docs/qie/qie-wallet)** | Found first and connected on its own inside its browser | "Recommended" in the connect sheet | | **[QIEDEX](/docs/qie/qiedex-and-qusdc)** | The escrow swaps your QIE for the exact QUSDC inside the payment; Get QIE swaps QUSDC back | "Swap: QIEDEX · 0.31%" on the review sheet | | **[QUSDC](/docs/qie/qiedex-and-qusdc)** | What the escrow holds and refunds | "Paid with" and refunds in QUSDC | | **[QIE ID](/docs/qie/qie-id)** | Names on receipts, the cashback tier, who may open a shop, one drop claim per ID, invite codes | `jun.qie` and its badges everywhere | | **[QIELend](/docs/qie/qielend)** | Borrow the bill against QIE instead of selling it | "Pay with a QIE-backed loan" | | **QIE Oracle** | The age of QIE's QIE/USDT feed, shown on the loan sheet | "QIE price feed is … old" | | **[FiatRateFeed](/docs/qie/rate-feed)** | Todoku's naira rate on QIE for anyone to read, once the feed is deployed | The scorecard's "Naira rate on QIE" | | **QIE explorer** | Every transaction a receipt mentions links to mainnet.qie.digital | **Payment ↗**, **Release ↗** | ## Our contracts [#our-contracts] The escrow and the feed are ready to deploy to QIE mainnet; until they are, the table above says so, and the app answers "Payments aren't open yet". Every QIE address Todoku calls is in [Addresses](/docs/qie/addresses). # QIE ID (/docs/qie/qie-id) QIE ID names every wallet on Todoku, sets the cashback tier and the daily limit, decides who may open a shop, and keeps drops to one claim per person. | Where | What QIE ID does | | --- | --- | | Every address | Shows the `.qie` name and its badges instead of `0x…` | | Cashback | 1× for every wallet, 1.5× with a premium `.qie` name, 2× with a verified QIE ID | | Daily limit | 300 QUSDC a day, 1,000 with a verified QIE ID | | Shops | Opening a shop needs a verified QIE ID or a paid `.qie` name, checked again on every sale | | Drops | "Verified QIE IDs only" drops allow one claim per ID | | Invites | Your `.qie` name is your invite code | | Shop page | `/a/` | ## How Todoku reads it [#how-todoku-reads-it] - **Names, premium names and verification** come from QIE ID's public API (`sdk-live.qie.digital`), keyless, cached for 10 minutes. - **Paid names** for shops are also read on chain: QIE ID's Metadata contract, `isPaid(keccak256("qie" + label))`. Get a name or verify at [id.qie.digital](https://id.qie.digital); **Account** links there. A newly verified ID can take up to 10 minutes to show. # QIE Wallet (/docs/qie/qie-wallet) Todoku looks for QIE Wallet first, lists it as Recommended, and connects on its own inside QIE Wallet's browser. | | | | --- | --- | | How it is found | QIE Wallet announces itself through EIP-6963 as `me.qiewallet`. When it doesn't, Todoku falls back to `window.qie`. It is never matched through `window.ethereum`, because QIE Wallet reports itself there as MetaMask | | In the connect sheet | First, as "Recommended". Other browser wallets show as "Browser wallet" | | Inside QIE Wallet's app browser | Todoku connects once by itself | | No wallet at all | "No wallet in this browser: install QIE Wallet, or open Todoku inside the QIE Wallet app", with **Get QIE Wallet** | | Wrong network | "Your wallet is on another network. Todoku runs on QIE Mainnet." with **Switch to QIE** | What you sign with it: | Action | Signatures | | --- | --- | | Pay a bill in QIE | 1 transaction | | Pay in QUSDC | 1 approval (when the allowance is short, usually every time), 1 payment | | Sign in for private pages | 1 message, free | | Claim a drop | 1 typed message, free, no gas | | Connect an AI app | 1 message, free | | Take your money back | 1 transaction | # QIEDEX and QUSDC (/docs/qie/qiedex-and-qusdc) You pay in QIE; the escrow swaps it on QIEDEX for the exact QUSDC the bill costs, inside the same transaction, and holds QUSDC until the bill settles. ## One swap inside the payment [#one-swap-inside-the-payment] When you pay in QIE, Todoku first asks QIEDEX's Swap API (`api.dex.qie.digital/quote`) for an **exact-out** quote: the QUSDC the bill needs, with 1% slippage. That gives the most QIE the payment may use, which your wallet sends with `payWithQIE`. Inside the transaction the escrow calls the QIEDEX router's `swapETHForExactTokens` along WQIE → QUSDC, checks that exactly the bill's QUSDC arrived, and sends any QIE it didn't need straight back to you. - The review sheet shows the swap's cost from QIEDEX ("Swap: QIEDEX · 0.31%") and "at most …" QIE. - If QIEDEX says the amount moves the price too much, Todoku refuses: "This amount moves the QIE price too much". - The price and the swap share one deadline: 60 seconds. ## Why QUSDC [#why-qusdc] A bill is priced in naira. Holding QUSDC, QIE's dollar stablecoin, keeps the held amount steady while the bill is bought: a refund gives back the same QUSDC you paid, whatever QIE's price did in between. Refunds come back in QUSDC, not QIE. Paying in QUSDC directly skips the swap: approve the escrow (the amount plus 3%, so a re-price still fits), then pay. ## QUSDC back to QIE [#qusdc-back-to-qie] **Get QIE** swaps QUSDC to QIE on QIEDEX (`/swap`), up to 1,000 QUSDC at a time, checked to call only the router and QUSDC. QUSDC's admin can grant a role that may burn any holder's QUSDC, including the escrow's. Todoku keeps holds small and short. [Risks](/docs/trust/risks) explains it. # QIELend (/docs/qie/qielend) Borrow the bill in QUSDC against QIE on QIELend, guided step by step, so holders pay bills without selling. QIELend is QIE's lending market (a Compound V2 fork). Todoku uses it so someone who won't sell QIE can still pay: supply QIE as collateral, borrow the bill's QUSDC, pay. The person signs each step; Todoku never holds the loan. The full walk-through is in [Borrow, don't sell](/docs/guide/borrow). | Step | Contract call | | --- | --- | | Wrap | `WQIE.deposit` | | Allow | `WQIE.approve(qWQIE, amount)` | | Supply | `qWQIE.mint(amount)`, simulated first; its return code must be 0 | | Collateral | `Comptroller.enterMarkets([qWQIE])` | | Borrow | `qQUSDC.borrow(amount)` | ## What Todoku reads [#what-todoku-reads] From QIELend's comptroller and markets: the oracle's price for WQIE, the collateral factor, the cash available, the borrow rate per block, and whether minting or borrowing is paused. It plans a loan that lands at a health of 2 (refusing under 1.5), and shows the age of QIE Oracle's QIE/USDT feed, warning after an hour. A borrow is attached to the order only after Todoku reads it on chain: it must call qQUSDC, emit `Borrow` for the payer, and land within 2 hours before the price. Mainnet only, and walked on a fork of QIE mainnet so far. # The naira rate on QIE (/docs/qie/rate-feed) Todoku publishes the reference naira rate it prices from as a Chainlink-style feed on QIE mainnet, so any contract or app can read it. `FiatRateFeed` is the same shape as QIE Oracle's own feeds (`AggregatorV3Interface`, 8 decimals), one deployment per currency, naira first ("NGN / USD"). | | | | --- | --- | | Answer | US dollars per 1 naira × 10⁸. ₦1,440 to the dollar is 69,444. Naira per dollar = 10⁸ ÷ answer | | Source | Paycrest's rate for selling USDC into naira, before Todoku's 1% margin | | When it publishes | Todoku's worker checks every 5 minutes and publishes when there is no round yet, the rate moved 0.5% or more, or the last round is 6 hours old | | Who can publish | Only the feed's owner (Todoku's operator wallet) | | Reads | `latestRoundData()`, `getRoundData(roundId)`, `latestRoundId()`, `decimals()`, `description()` | ## Read it [#read-it] ```ts title="read-naira-rate.ts" import { createPublicClient, http, parseAbi } from "viem"; const feed = "0xd97837d5f7E0aAD0648E262FA0d374Ef9756934a"; // FiatRateFeed NGN / USD on QIE mainnet const abi = parseAbi([ "function latestRoundData() view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)", ]); const client = createPublicClient({ transport: http("https://rpc5mainnet.qie.digital") }); const [roundId, answer, , updatedAt] = await client.readContract({ address: feed, abi, functionName: "latestRoundData" }); console.log(`₦${(1e8 / Number(answer)).toFixed(2)} per $1, round ${roundId}, at ${new Date(Number(updatedAt) * 1000).toISOString()}`); ``` The scorecard shows the latest round. Round 1 went out on 25 November 2026 at 70,200, about ₦1,424.50 to the dollar. (Before a feed's first round, `latestRoundData` reverts with `RoundNotFound`.) # Why your money is safe (/docs/trust) The promise is in a contract, not in a support queue. What the escrow guarantees on its own, and what Todoku adds around it. ## What the contract guarantees, whatever Todoku does [#what-the-contract-guarantees-whatever-todoku-does] | Guarantee | Because | | --- | --- | | Your payment can only go to Todoku's treasury after delivery, back to you, or (for drops) to the funder | Those are the only paths in `TodokuEscrow`; it can't be upgraded | | You can take a held payment back yourself | `reclaim` works for the wallet that paid once `RECLAIM_DELAY` passes, even while the contract is paused | | Refunds still work when Todoku pauses | `pause` stops new payments, drop funding and claims, and releases; `refund`, `reclaim` and `reclaimPot` keep working | | Nobody can take more than the price Todoku signed | Each order's amount is fixed in the signed quote; the contract checks the exact QUSDC | | The contract never pays out what it owes to anyone else | The admin can sweep only the balance above what it owes; tested as an invariant. Only an outside QUSDC burn could push the balance below it ([Risks](/docs/trust/risks)) | | A price can't be replayed | Every order id is single-use, and quotes expire | ## What Todoku adds [#what-todoku-adds] | Practice | Where | | --- | --- | | Verify before pay: meters, smartcards and JAMB codes are checked by name | [Electricity](/docs/guide/electricity), [TV](/docs/guide/tv) | | Only the provider's answer settles an order; webhooks are only a hint | [Bill providers](/docs/developers/providers) | | Refunds as soon as the provider says failed, in seconds | [Scorecard](/docs/trust/scorecard) | | Caps, kill switches, a float breaker and a duplicate guard on every price | [Safety rails](/docs/trust/safety-rails) | | A public record checked against the escrow's events | [Scorecard](/docs/trust/scorecard) | | Numbers encrypted; tokens and PINs only for the payer | [Privacy](/docs/trust/privacy) | ## The keys [#the-keys] The admin key (roles, limits, unpause) stays off the server, and handing it over takes a one-day delay. The operator key can only release or refund along the contract's paths. The quote key only signs prices. The rewards key pays from its own small wallet under daily caps. Details: [The worker](/docs/developers/worker#signing-lanes). # The operator console (/docs/trust/operator-console) Where Todoku's operators watch the money, settle orders the provider can't answer, reply to tickets, suspend shops and flip the kill switches, all within the contract's paths. `/ops` opens only for wallets listed in `OPS_WALLETS`, after they sign in. Every `/api/ops` call checks both, nothing in the app links to it, and the page refreshes every 15 seconds. | Tab | What an operator sees and does | | --- | --- | | **Money** | What the escrow holds against what it owes, the treasury, the operator's gas (a warning under 1 QIE), the provider float against what open orders promise, and the last 24 hours by status | | **Review** | Orders still pending 24 hours after they were sent, or that the provider called delivered for a different amount or with fewer PINs: **Ask provider again**, **Refund payer** (refund reason 5) or **Mark delivered** (evidence required: the provider's transaction id or what support said). Refund and Mark delivered ask once more, naming the amount, before they run. Below: **Late outcomes (72 h)** | | **Support** | Open tickets with their reason and the order; reply, or **Reply and close** | | **Agents** | Every shop with its delivered sales; suspend with a reason the shop sees, or reinstate | | **Switches** | The 14 [kill switches](/docs/trust/safety-rails#kill-switches) it knows, plus any other already set, running or paused, and whether each paused itself | ## What an operator can't do [#what-an-operator-cant-do] An operator works through the same rails as the worker. **Refund payer** and **Mark delivered** only move the order to failed or delivered; the money then moves through the contract's `refund` or `release`, so it can only go back to the payer or to Todoku's treasury. The console has no way to send escrowed money anywhere else, and no button for a refund from the treasury after a release ([Risks](/docs/trust/risks)). Telegram sends operators alerts for orders that need review, a bill delivered after its refund, new tickets and a low provider balance, each with **Open ops**. # Privacy (/docs/trust/privacy) Who sees what. Nothing personal goes on chain, numbers are encrypted, and tokens and PINs show only to the wallet that paid (and, for a pay link, to the person who asked). | Who | Sees | Never sees | | --- | --- | --- | | **Anyone on QIE** | Random order ids, the paying wallet, QUSDC amounts, the coin used, refund reason codes | Phone numbers, meters, names, tokens | | **Anyone with a receipt link** | The bill, amount, status, the number's last 4 digits, the payer's `.qie` name or short address, the transactions | The full number, the holder's name, the token or PINs | | **Anyone with an order's id** | Its status page: the same as the receipt plus the masked holder name and delivery details | The full number, the token | | **The landing page** | The last finished orders: the bill, amount and time, and the release link | Who, which number, refunds' wallets | | **The payer, signed in** | Everything about their own order, including the token or PINs | Other people's orders | | **Whoever asked for a pay-link bill** (Telegram linked) | Who paid (their `.qie` name or short address), and the token or PINs of that bill in the chat | The payer's other orders | | **A shop's customer** | The printed receipt, with the token or PINs once delivered | | | **An AI app you connected** | Your orders and saved numbers by their last digits | Tokens, PINs, full numbers, and any way to pay | | **Todoku's operators** | What they need to fix an order | Your keys; Todoku never holds them | ## How it is stored [#how-it-is-stored] - Phone, meter and smartcard numbers, SMS phones, shop customer notes, shop phones, tokens, key-change codes and PINs are encrypted with AES-256-GCM. - Duplicate checks use a keyed HMAC of the number instead of the number. - AI app tokens and codes are stored only as SHA-256 hashes. - A pay link's note is stored as written; don't put a secret in it. - Receipts aren't indexed by search engines, and their link is separate from the order's id. Signing in is a single message your wallet signs; the session cookie is HTTP-only and lasts 7 days. # Regulation in Nigeria (/docs/trust/regulation) The Central Bank of Nigeria's November 2026 rules cover paying with virtual assets, including from outside Nigeria. A fact to know, not legal advice. In November 2026 the Central Bank of Nigeria published its Regulations for the Operations of Non-Security Virtual Assets in Nigeria, reported in force from **5 November 2026**. | What the rules say | What it means for Todoku | | --- | --- | | They apply to activity "carried out in Nigeria", "carried out from Nigeria" or "directed at persons in Nigeria" | Paying Nigerian bills with QIE falls inside them, wherever Todoku runs | | §9.13: no one may facilitate using a stablecoin or other virtual asset for payment unless it is an approved instrument and the person holds the required licence | Accepting QIE or QUSDC for bills needs that licence or authorisation | | The rules name acting as an **agent of a licensee** (§21) as the route for smaller operators | The path Todoku would take to serve Nigeria at scale | | §9.1(c): converting virtual assets to naira for a customer is its own licensed service | Todoku doesn't cash anyone out: it sells bills, and refunds go back in QUSDC to the wallet that paid | Todoku's design keeps the payer in charge of their own money: it never holds user keys, refunds go back on chain, and every payment is visible on QIE. This page records a fact about the rules, not legal advice. # Risks (/docs/trust/risks) What could still go wrong, said plainly, with what Todoku does about each one today and what isn't built yet. ## QUSDC can be burned by its issuer's role [#qusdc-can-be-burned-by-its-issuers-role] QUSDC is QIE's dollar stablecoin and what the escrow holds. Its contract lets any holder of `VAULT_ROLE` mint, and burn QUSDC **from any address**, without an allowance. Today that role sits with QIE's vault contract, and the role's admin is a single wallet that could grant it to anyone. QUSDC has no pause and no blocklist. In the worst case, QUSDC held in Todoku's escrow could be burned. What limits the damage today: - **Small holds.** At most 100 QUSDC per order and 300 QUSDC a day per wallet (1,000 verified). - **Short holds.** Airtime and data usually settle in seconds; the money sits in the escrow only between payment and delivery. - **A solvency check every minute.** If the escrow ever holds less than it owes, Todoku turns on the `global` switch and stops taking new payments. A watcher on QUSDC's `RoleGranted(VAULT_ROLE)` events that pauses intake and alerts the team was planned. Today only the solvency check above would notice, after the fact. ## The contract trusts Todoku to say "delivered" [#the-contract-trusts-todoku-to-say-delivered] The escrow can't see whether airtime reached a phone. Todoku's operator key tells it, after the provider confirms. The contract still stops that key from sending money anywhere except Todoku's treasury or back to the payer, or from touching an order twice. Every release is public on QIE, and the [scorecard](/docs/trust/scorecard) counts them against Todoku's own records. ## The provider [#the-provider] Nigerian bills are bought from VTpass with a naira float. If VTpass is down or the float runs low, the float breaker stops new prices and paid orders are refunded or wait for an answer; nothing is charged for a bill that can't be bought. A reversal **after** Todoku has released the payment isn't detected automatically and has no refund path in the app yet; if the payer reports it on the order's ticket, an operator would have to refund from the treasury by hand. ## QIE's price inside the 60 seconds [#qies-price-inside-the-60-seconds] The price is held for 60 seconds and the swap asks for an exact amount of QUSDC, so you pay at most the "at most" QIE shown and get the rest back. If QIEDEX says the amount moves the price too much, Todoku refuses the price. ## Prices from outside [#prices-from-outside] The naira rate comes from Paycrest; if it can't be fetched, Todoku uses a rate up to 10 minutes old and then stops pricing. QIE Oracle's QIE/USDT feed has a single owner and can be hours old, so Todoku only shows its age; it never prices bills with it. # Safety rails (/docs/trust/safety-rails) Limits on every order and wallet, switches to stop any part, a breaker that refuses bills Todoku can't buy, and a guard against paying twice. ## Limits [#limits] | Limit | Value | | --- | --- | | One order | 100 QUSDC (checked by Todoku and by the contract) | | One payment (bulk) | 2,000 QUSDC, 20 lines | | One wallet, rolling 24 hours | 300 QUSDC; 1,000 with a verified QIE ID (drops count toward the funder's) | | Live prices for one bill | 2 (one in QIE, one in QUSDC) | | One drop's pot | 5,000 QUSDC | | Exam PINs | 1 to 10 per order | ## Kill switches [#kill-switches] Checked on every price. An operator flips them in the ops console (the 14 it lists; the others, such as `surface:web` or `service:`, are set through the ops API and then show there too); some flip themselves. | Switch | Stops | | --- | --- | | `global` | Every new price. Turned on by itself if the escrow ever holds less than it owes | | `provider:vtpass`, `provider:fonbnk` | That provider's bills; held orders for it are refunded instead of bought. The float breaker sets it | | `kind:airtime` … `kind:exam` | One kind of bill | | `service:` | One biller | | `asset:QIE`, `asset:QUSDC` | Paying with that coin | | `surface:web`, `agent`, `pay_link`, `drop`, `demo_line`, `mcp`, `mcp_auth` | One way in | | `vend_pause` | Buying from providers; paid orders wait in the escrow and are retried every minute | ## Float breaker [#float-breaker] Todoku buys bills from a naira float at the provider. Before every price it subtracts what open orders already promise from the provider's balance, and refuses the bill unless what's left covers it plus the larger of ₦20,000 or 10%. Balances refresh every minute. An "out of float" answer from VTpass closes the provider at once; it reopens when the balance is back. Operators get a Telegram alert under ₦50,000, at most hourly. ## Paying twice [#paying-twice] - **Same bill twice in a day**: the same amount to the same number and service in the last 24 hours shows "You just bought this", and needs **Pay again anyway**. - **Same number in flight**: while an order for the same service to that number is being paid, held, delivered or reviewed, a new one is refused until it finishes: "An order for this number is on its way". - **Pay links**: one payer at a time; a second payment that slips through is refunded without buying. - Numbers are compared by a keyed hash, so the check never needs the number in the clear. ## Doing things once [#doing-things-once] Unique keys on chain order ids, provider request ids, chain events, signed transactions per purpose, refunds, rewards and webhook bodies; one live purchase per order; job singletons per order; and a read of the order's on-chain status before any release or refund is signed. # The scorecard (/docs/trust/scorecard) Every order paid in the last 30 days, delivered or refunded, with the times, checked against the escrow's own events. Here is how each number is counted. [/scorecard](/scorecard) is public and recomputed every minute. | Number | How it is counted | | --- | --- | | **Delivered** | Delivered ÷ (delivered + refunded + taken back), over orders paid in the last 30 days. Delivered means released, or delivered after a refund | | **Time to deliver** | From paid to delivered: the median, and the time 9 in 10 finished within | | **Time to refund** | From paid to the money back (refund or reclaim): the median, and the time 9 in 10 finished within | | **Orders paid** | Orders paid in the window, and the naira delivered | | **Last 30 days** | Delivered and refunded per Lagos day, with a table view | | **By service** | Orders, the delivered rate and the usual time to deliver, per service | ## Checked against the escrow [#checked-against-the-escrow] The page compares, for all time on the current escrow, how many orders Todoku's database says were released, refunded and taken back with how many `OrderReleased`, `OrderRefunded` (and refunded-to-pot) and `OrderReclaimed` events the escrow emitted. When all three match it says "Every finished order ended where it should". The events come from Todoku's own index of the escrow; anyone can recount them on the explorer. The page also shows the latest round of the naira rate feed on QIE, once it is deployed. # Status today (/docs/trust/status) What runs today, what is on QIE mainnet, what waits for VTpass's live access, and what is built but switched off or not finished. Updated with every release. Last updated 25 November 2026. ## Running [#running] | Part | Where | | --- | --- | | The site, the app, the scorecard and these docs | [todokupay.xyz](https://todokupay.xyz) | | Every pay screen, verify-before-pay, receipts, history, shops, drops, pay links, rewards | The app; paying on production waits for VTpass (below) | | The same app on VTpass's test system, on its own mainnet escrow | [staging.todokupay.xyz](https://staging.todokupay.xyz): payments, releases and refunds are real QIE transactions; the airtime is VTpass test airtime | | The Telegram bot | [@Todoku1_bot](https://t.me/Todoku1_bot) | | The MCP endpoint and AI app sign-in | `mcp.todokupay.xyz/mcp` | | A full test build (a local QIE test chain with VTpass's sandbox) where the flows in these docs were walked, except the QIELend loan (a mainnet fork only), the mainnet Get QIE swap, Telegram and Fonbnk | The test build behind every screenshot here | ## On QIE mainnet [#on-qie-mainnet] Deployed on 25 November 2026, each with verified source: | Contract | Address | | --- | --- | | `TodokuEscrow`, production (24-hour reclaim) | [`0x2a2fD1193f51Bca1ABF85012316F3e835E6eE2a5`](https://mainnet.qie.digital/address/0x2a2fD1193f51Bca1ABF85012316F3e835E6eE2a5) | | `TodokuEscrow`, staging (10-minute reclaim) | [`0xff54634a5f27D7770Cd4C63dff46D3b0dce6a783`](https://mainnet.qie.digital/address/0xff54634a5f27D7770Cd4C63dff46D3b0dce6a783) | | `FiatRateFeed` NGN / USD | [`0xd97837d5f7E0aAD0648E262FA0d374Ef9756934a`](https://mainnet.qie.digital/address/0xd97837d5f7E0aAD0648E262FA0d374Ef9756934a) | The feed published its first round the same day. [Addresses](/docs/qie/addresses) reads the same list from the running app. ## Waiting for VTpass [#waiting-for-vtpass] Production is set up for VTpass's live system, but VTpass hasn't switched on live API access for Todoku yet (requested 25 November 2026). Until it does, production answers "Payments aren't open yet", including the ₦100 gift in [Try it](/docs/guide/try-it). The first real-mainnet walks follow: a ₦100 MTN airtime on production, and a loan on QIELend. ## Built, switched off [#built-switched-off] | Part | Why | | --- | --- | | Kenya and Ghana airtime (Fonbnk) | Off until Fonbnk enables order creation for Todoku | ## Not built yet [#not-built-yet] - A watcher that pauses intake when QUSDC's `VAULT_ROLE` is granted ([Risks](/docs/trust/risks)). - A refund path for a provider reversal after release. - Cancelling a pay link from the website (AI-made links can be cancelled from their card). - Receipt printing outside shop mode. - WalletConnect; QIE Wallet and browser wallets work today.