KaapDocsCheck a treasury
KaapDocs
How it works

The guard

The contract that votes, the ten checks before it does, and the one vote it can cast.

The guard is a contract on NEAR. In an enrolled treasury it is the only member of one role, and that role can vote to reject and nothing else.

One vote, one direction

The only call the guard ever makes to another contract is a vote on the treasury, and the vote is fixed in its code as reject. It cannot approve, pay, file a request or change a rule, and it holds no funds.

Its role leaves out one kind of request: removing a member from a role. So the guard can never block its own removal.

The ten checks

Anyone may hand the guard a verdict. The signature on it is what counts, not who carries it. Before it votes, the guard checks two things about the call itself: that it carries enough gas for the vote to reach the treasury (900 Tgas), and that the request is no larger than one transaction can carry (217 KiB). Then eight about the verdict, in this order:

  1. The verdict is in the format it knows.
  2. The signature is valid for the one key it obeys, the sealed reader's.
  3. The verdict names this guard and this network.
  4. The treasury it names has enrolled.
  5. The veto rule below holds.
  6. The verdict has not expired. Kaap's watcher asks for verdicts that live ten minutes, and the sealed reader signs none that lives longer than 15.
  7. The request it was handed is, byte for byte in meaning, the request the verdict judged.
  8. The verdict has never been used before.

If any check fails, the guard does nothing and says which one failed.

The veto rule

The guard votes only when all of this is true:

  • the verdict's risk is critical;
  • the plain-code floor is high or critical;
  • at least one plain-code finding is high or critical in its own right, and that finding is not "the hash could not be read";
  • either the plain code alone reached critical, or the AI's answer passed every check.

Two things follow. The AI alone can never cause a veto: there must be a finding from plain code behind it. And a request whose hash Kaap could not read is flagged to members but not vetoed, because "unreadable" is not proof of a theft.

Who can change it

Nobody can change the guard's code. The deploy script deleted the account's only access key right after setting it up, and the contract has no upgrade method. A new version is a new contract that a treasury chooses to adopt.

One thing can change: the key the guard obeys. A new project of the sealed reader has a new key, so the guard's owner, an account held by Kaap's founder, can replace it. The change is announced on chain and takes effect 24 hours later at the earliest. The owner can cancel it in that time, the watcher tells every treasury's members at once, and kaap arming and kaap verify warn while one is pending.

Strict mode

A treasury can choose strict mode, where the guard also rejects any request whose hash Kaap could not read. It is one setting per treasury, chosen by the treasury's own vote, and turning it off reads as weakening the guard. The guard on testnet has it since 13 Nov 2026. The demo treasury is in the default mode, so on testnet strict mode is shown by tests, not yet by a live reject.