Drag to turn
How it works

The whole protocol, in plain words.

What the contract enforces, what each of the seven knights checks, how a fee and a score are computed, what a default does, and how to check any of it yourself. Where this page and the contract disagree, the contract is right.

Overview

Round Table lends small amounts of USDG, from $5 to $500, to AI agents that hold an ERC-8004 identity on Robinhood Chain (chain id 4663). It is one contract, with no proxy and no upgrade path, and a server that runs seven public checks on every application.

  • The money. The treasury holds only USDG the team sends in with fund(): $10 at launch, topped up by hand afterwards. There are no outside deposits, no shares and no yield. Every open line is fully covered: the part not yet borrowed is reserved in the contract. When a loan defaults, the treasury takes the loss.
  • The decision. Seven seats, the knights, each run one check and cast one vote. The contract opens a line only with 4 of 7 yes votes, and two of them must come from seat 0 (identity) and seat 2 (record).
  • The record. Every application, verdict, loan, repayment and default is a contract event. Every verdict is published as a JSON file, and the keccak256 hash of that file is sealed on chain.
  • The ladder. A first line is $5. It can rise one rung, up to $500, for each loan that counts in full: a term of 7 days or more, repaid on time, held at least half the term.

Round Table is not a bank and does not lend to people. Lines are for AI agents, they are small on purpose, and they can be lost.

From application to repayment

  1. Application.The owner writes the purpose of the loan in one or two plain sentences and publishes it with POST /api/purpose, which returns the keccak256 hash of the text (whitespace collapsed, at most 600 characters). The owner wallet then calls applyForLine(agentId, purposeHash). The contract checks that the caller owns the agent id in the ERC-8004 registry and that the agent has never defaulted, then emits Applied.
  2. Seven seats.The server sees Applied, waits up to two minutes for the purpose text if it has not arrived yet, and runs the seven checks in order. Sir Gawain goes first because the others reuse the registration file he loads. A seat whose check fails with an error votes no. The line asked for is always the agent's next rung: ladder(qualified), if that is above its current line or the agent changed owner.
  3. Seal.The verdict (every seat's vote, reason and evidence) is written as canonical JSON (keys sorted, no spaces) and published at /verdicts/<hash>.json. The council key then calls seal(agentId, votes, line, verdictHash). The contract checks the votes, the required seats and the ladder again, and refuses the line if idle USDG could not cover it together with every other open line. A refusal is sealed with line 0 and leaves any existing line as it was.
  4. Borrow.The owner, or an operator wallet the owner named with setOperator, calls borrow(agentId, amount, termDays, maxFee): at least 1 USDG, a term of 1 to 30 days, and never more than the line minus what is already owed. The fee and the due time are fixed in that moment. The USDG goes to the caller.
  5. Repay.Anyone may call repay(loanId) after approving principal plus fee. A loan repaid by its due time is on time. If its term was 7 days or more and it was held at least half the term, it is also qualified, and the agent's next application can rise one rung.

Lines do not rise on their own. To climb, the owner applies again and the seven seats sit again.

The seven knights

Each knight is one small function in server/knights.mjs with one question and one public check. Its vote, a one-line reason and the evidence it read all go into the verdict file. Reasons come from fixed templates, except Sir Galahad's when the language model is online. Seats 0 and 2 are required: without both, no line opens, whatever the other five say.

Loading the seven seats…

Rules the contract enforces

These are written in RoundTable.sol. Nobody can change them, the team included, because the contract has no upgrade path.

  • Only the council key can call seal, and only to answer an application the agent's owner opened.
  • A line above zero needs at least 4 of 7 yes votes, with the bits for seat 0 (identity) and seat 2 (record) both set.
  • A line can never be above ladder(qualified), the rung the agent has earned. The top is MAX_LINE, 500 USDG.
  • A new line must be a raise, unless the agent changed owner since its last line.
  • An agent with a default cannot apply and cannot be given a line, ever.
  • Loans: at least 1 USDG (MIN_LOAN), 1 to 30 days (MAX_TERM_DAYS), and outstanding principal never above the line.
  • The fee stays between 0.25% and 3% per 30 days (FEE_BPS_MIN 25, FEE_BPS_MAX 300).
  • A loan can be marked defaulted only after its due time plus 7 days (GRACE).
  • Every open line is fully reserved. reserved is the part of all lines not borrowed yet, and idle USDG must stay at or above it: seal refuses a line the treasury cannot cover.
  • A treasury withdrawal must be announced on chain 2 days before it can execute (WITHDRAW_DELAY), and it can only take idle USDG above reserved. Lent principal is not in the contract, and reserved USDG is promised to open lines, so neither can be withdrawn.
  • Pausing stops new loans only. Repayments and defaults can never be paused.

When the agent changes hands

A line belongs to the owner who held the agent when it was sealed. If the ERC-8004 identity moves to a new wallet, the line freezes and any operator stops working. The new owner must apply again. The record (qualified loans, defaults, score) stays with the agent id.

What the contract cannot check

The contract trusts the vote bitmask the council key sends. It cannot see whether the seven checks really ran or what they found. That is why every verdict is published with its evidence and sealed by hash: anyone can compare the votes on chain with the file. The daily cap on new lines (6 per UTC day) is also a server rule, not a contract rule: Sir Kay votes no once it is reached. His seat is not required, so his no is one vote among seven, not a block; the contract's own coverage rule is what stops a line the treasury cannot fund. The same holds for Sir Bors.

The ladder

Qualified loansHighest line
0 (first line)$5
1$10
2$25
3$50
4$100
5$250
6 or more$500

A loan is qualified when its term was 7 days or more, it was repaid by its due time, and it was held at least half the term. A 14-day loan repaid after 2 days does not qualify. A 5-day loan never qualifies, however it is repaid.

Fees

The fee is set per 30 days in basis points (feeBps). It starts at 100, which is 1% per 30 days. The steward can move it between 25 and 300 (0.25% to 3%).

fee = ceil( amount × feeBps × termDays / 300,000 )      (in USDG units, 6 decimals)
  • Charged by the day for the term chosen at borrow time, with one day minimum. The fee is fixed when you borrow: repaying early does not lower it, and a later fee change does not touch an open loan.
  • Rounded up to the smallest USDG unit, so even a tiny loan pays something.
  • maxFee in borrow protects the borrower if the fee changes between the quote and the transaction.
  • Fees are paid into the treasury with the principal. Nobody else receives them.
Loan at 1% per 30 daysFee (USDG units)Fee
$1 for 1 day334$0.000334
$5 for 7 days11,667$0.011667
$5 for 14 days23,334$0.023334
$100 for 7 days233,334$0.233334
$500 for 30 days5,000,000$5.00

Ask the contract for an exact quote with quoteFee(amount, termDays), or canBorrow(agentId, caller, amount, termDays) for the fee plus the reason a loan would be refused.

The score

score(agentId) is a number from 0 to 1000 that the contract computes from the agent's own repaid loans. Nobody types it in. It grows with dollars held over days, counts real use far more than quick round trips, and falls hard after a default.

// on every repay (open, defaulted and recovered loans add nothing)
held         = repaidAt - start                       // seconds
term         = due - start                            // seconds
heldForReal  = term >= 7 days  and  held * 2 >= term
weight       = heldForReal ? 1000 : 50                // per thousand: 100% or 5%
if repaidAt > due:  weight = weight / 2               // late counts half
weightedDollarDays += principal * held * weight / (86400 * 1000)

// score(agentId)
s = isqrt(weightedDollarDays / 10^4)                  // = isqrt(dollar-days × 100)
s = min(s, 1000)
if defaults > 0:  s = max(0, min(s, 600) - 200 * defaults)

All values are integers in USDG units (6 decimals), so every division rounds down, and isqrt is the integer square root.

Worked example

An agent borrows $5 for 14 days and repays on day 10, exactly 10 × 86,400 seconds after it borrowed.

  • principal = 5,000,000 units; held = 864,000 s; term = 1,209,600 s.
  • The term is at least 7 days, and held × 2 = 1,728,000 ≥ 1,209,600, so the loan was held for real. It was repaid before its due time, so it is on time. Both together: qualified. The agent's next application can ask for $10.
  • weight = 1000, so weightedDollarDays grows by 5,000,000 × 864,000 × 1000 / 86,400,000 = 50,000,000. That is $5 × 10 days = 50 dollar-days.
  • score = isqrt(50,000,000 / 10,000) = isqrt(5,000) = 70 (the square root is 70.71, rounded down).

The same loan repaid on day 2 is not held for real (4 days < 14), so it counts 5%: 5,000,000 × 172,800 × 50 / 86,400,000 = 500,000, and the score is isqrt(50) = 7. It does not qualify either.

The cap of 1000 is reached at 10,000 weighted dollar-days, for example $500 held for 20 days on loans that count in full. A score is evidence of past behaviour, not a promise about the future.

Defaults

  • Once a loan is more than 7 days past its due time and still open, anyone may call markDefault(loanId). There is no reward for doing it; the caller's address is recorded in the event.
  • The loan becomes defaulted. The agent's line drops to 0, its defaults count goes up by one, and any open application is closed. The principal is booked as lost (totalLostPrincipal), and the treasury takes the loss.
  • The default is permanent. applyForLine and seal both refuse an agent with a default, so it can never hold a line again.
  • The score is capped at 600 and loses 200 per default.
  • Anyone may still repay a defaulted loan. Principal and fee go back to the treasury as Recovered, but the default stays on the record.
  • Sir Bedivere votes no while any of the agent's loans is past due, even inside the 7-day grace. Sir Bors votes no for any agent whose owner has another agent with a default; his seat is not required, so that is one vote, not a block.

There is no collateral and no liquidation. The only things that stand behind a loan are the small size of the line and the record the agent would lose.

Verify a verdict

Every verdict can be checked by anyone without trusting this site.

  1. Find the Sealed event for the agent. It carries the agent id, the owner, the vote bitmask, the line and the verdictHash.
  2. Download /verdicts/<verdictHash>.json. Keep the bytes exactly as served: do not reformat or pretty-print the file.
  3. Compute keccak256 of those bytes. It must equal verdictHash.
  4. Read the votes: bit i of the bitmask is seat i. For example, 127 means all seven said yes, and 60 (binary 0111100) means seats 2, 3, 4 and 5 said yes. They must match the vote fields in the file.
  5. Optional: keccak256 of the purpose text in the file must equal the purposeHash in the agent's Applied event.

With Foundry's cast:

# 1. the sealed hashes, straight from the chain (some RPCs limit the block range per request)
cast logs --rpc-url https://robinhood-rpc.publicnode.com \
  --address <TABLE> --from-block <DEPLOY_BLOCK> \
  "Sealed(uint256 indexed agentId, address indexed owner, uint8 votes, uint256 line, bytes32 verdictHash)"

# 2. the published file, hashed byte for byte
curl -s https://roundtable.credit/verdicts/<verdictHash>.json -o verdict.json
cast keccak < verdict.json      # must print the same verdictHash

Or in JavaScript with viem:

import { keccak256 } from "viem";
const res = await fetch("https://roundtable.credit/verdicts/" + verdictHash + ".json");
const bytes = new Uint8Array(await res.arrayBuffer());
console.log(keccak256(bytes) === verdictHash); // true

The The Table page does this for every verdict in your browser. It reads the seal transaction from a public RPC, not from our server.

Contract interface

Amounts are in USDG units (6 decimals). Agent ids are ERC-8004 token ids.

Anyone

fund(uint256 amount)Adds USDG to the treasury. A gift to the lending pool, not a deposit: no shares, no way to take it back.
repay(uint256 loanId)Repays principal plus the fixed fee. Anyone may repay any loan. On a defaulted loan this records a recovery.
markDefault(uint256 loanId)Marks an open loan defaulted, once more than 7 days have passed since its due time.

Agent owner (and operator)

applyForLine(uint256 agentId, bytes32 purposeHash)Opens an application. Owner only; refused after a default.
setOperator(uint256 agentId, address operator)Names a hot wallet that may borrow for the agent. address(0) clears it. Stops working if the agent changes owner.
borrow(uint256 agentId, uint256 amount, uint256 termDays, uint256 maxFee) → loanIdOwner or operator. USDG goes to the caller.

Council key

seal(uint256 agentId, uint8 votes, uint256 line, bytes32 verdictHash)Answers an open application within the rules above.

Steward

setCouncil(address next)Rotates the council key. Takes effect at once.
setFee(uint256 bps)Between 25 and 300. Applies to new loans only.
setBorrowPaused(bool paused)Pauses or resumes new loans. Repayments and defaults are never paused.
announceWithdrawal(address to, uint256 amount) · cancelWithdrawal() · executeWithdrawal()Moves idle treasury USDG out, no earlier than 2 days after the announcement, and never below reserved. A new announcement replaces the pending one and restarts the 2 days.
proposeSteward(address next) · acceptSteward()Two-step hand-over of the steward role. The proposed address must accept.

Reads

getAgent(agentId) · getLoan(loanId) · loanCount()The full on-chain record of an agent and of every loan.
score(agentId) · ladder(qualified)The score from 0 to 1000, and the highest line for a number of qualified loans.
quoteFee(amount, termDays) · canBorrow(agentId, caller, amount, termDays) → (ok, reason, fee)What a loan would cost, and whether it would go through right now.
idle() · stats() · principalOut · totalLent · totalFunded · totalWithdrawn · totalRepaidPrincipal · totalFees · totalLostPrincipal · totalRecovered · reserved · defaultsCountTreasury books. Every number can also be rebuilt from events.
steward · pendingSteward · council · feeBps · borrowPaused · pendingWithdrawal · usdg · registryRoles, parameters and the two fixed external contracts.

Events

Applied · Sealed · OperatorSetApplications, verdicts and operator wallets.
Borrowed · Repaid · Defaulted · RecoveredThe life of every loan. Repaid carries onTime and qualified.
Funded · WithdrawalAnnounced · WithdrawalCancelled · WithdrawnEvery movement of treasury money in or out, other than loans.
CouncilSet · FeeSet · BorrowPaused · StewardProposed · StewardAcceptedEvery change the steward makes.

The $TABLE token

$TABLE does two things, and only two.

  • It pays for running the table. Creator fees from $TABLE go to the team wallet and pay for the server, the council's gas and the language model. They are not sent to the treasury automatically: the team tops the treasury up by hand with fund(), and every top-up is a public Funded event, listed on the Proof page.
  • It opens more questions. A wallet holding at least 100,000 $TABLE can sign a free message (no transaction) and ask the knights 50 questions a day instead of 5.

That is all. $TABLE pays no yield and no share of fees, gives no vote, and is no claim on the treasury. The lending contract does not know the token exists, and you do not need it to apply or to borrow.

Risks

Read these before you borrow, fund the treasury or hold $TABLE.

  • New contract, no outside audit. The contract has a Foundry test suite, including fuzz tests and invariant tests, written by the team (results on the Proof page). Tests are not an audit.
  • The council key is centralized, and it decides. One key run by the team signs every verdict. The contract limits what it can do, but it trusts the votes it is sent. A lost or misused council key could grant lines, up to each agent's rung, to any open application whatever the checks found. Published verdicts let anyone catch that afterwards; they cannot stop it beforehand. The steward can replace the council key at any time, with no delay.
  • The treasury can be withdrawn. After a 2-day public announcement, the steward can take out all idle USDG that open lines do not rely on (idle minus reserved). Lent principal cannot be taken, but once it is repaid and no line reserves it, it can be. The steward can also pause new loans for as long as it likes.
  • The server is a single point. If it stops, applications stay open and unanswered. Repayments and defaults still work directly on the contract.
  • Sir Galahad uses a language model. When the model is online it judges the purpose text; models can be wrong, and the text they read can try to mislead them. Written rules refuse first, and the model only sees purposes that pass them. When it is offline the rules alone decide, and the verdict records which method was used.
  • The checks are light on purpose. An endpoint that answers, a wallet with two transactions and a little ETH: these are cheap to fake. Sir Bors votes against a second first line for the same owner, but his seat is not required. The small size of the lines is the real defence.
  • External contracts. USDG and the ERC-8004 identity registry are contracts Round Table does not control and cannot change. If either misbehaves, the table is affected.
  • Small amounts. The treasury is small. A few defaults can use most of it. Lines already open stay covered, because the contract reserves them, but no new line or raise can open until the treasury is refilled.
  • The token. $TABLE is no claim on anything. Its price can fall to zero.