{
  "schema": "poa-sta-contracts-v1",
  "repoCommit": "09e057981901c0506507b67463959a09a2efc9d9",
  "source": {
    "path": "stake-to-audit/docs/DESIGN_RATIONALE.md",
    "sha256": "f712cbe6c5e5312a723cb42130ca8e9f3d88155525d02b700492a7a0fd756b62",
    "bytes": 20701
  },
  "contracts": [
    {
      "name": "CampaignFactory",
      "library": false,
      "purpose": "Exists to create isolated, immutable campaigns from versioned implementations, and to be the only place with administrative power, which is limited to the future.",
      "functions": [
        {
          "function": "`constructor(owner, guardian)`",
          "caller": "deployer",
          "whatAndWhy": "Fixes roles; refuses chains other than Anvil and Sepolia.",
          "enforces": [
            "T-30"
          ],
          "rejected": "Runtime chain flag (could be flipped)."
        },
        {
          "function": "`registerVersion(set)`",
          "caller": "owner",
          "whatAndWhy": "Appends an implementation set. Existing versions are never edited, so existing campaigns cannot change.",
          "enforces": [
            "T-03",
            "T-15"
          ],
          "rejected": "Upgradeable implementations (would change live rules)."
        },
        {
          "function": "`setTokenAllowed(token, allowed)`",
          "caller": "owner",
          "whatAndWhy": "Allowlist for new campaigns only.",
          "enforces": [
            "T-26",
            "F-02"
          ],
          "rejected": "Any token (fee-on-transfer and rebasing break accounting); per-campaign allowlist edits (would affect live campaigns)."
        },
        {
          "function": "`setGuardian(guardian)`",
          "caller": "owner",
          "whatAndWhy": "Names who can pause new deposits.",
          "enforces": [
            "T-25"
          ],
          "rejected": "No pause at all (no response to a discovered bug in a new version)."
        },
        {
          "function": "`pauseNew(duration)`",
          "caller": "guardian",
          "whatAndWhy": "Stops creation and new deposits for ≤ 7 days, with cooldown.",
          "enforces": [
            "T-25"
          ],
          "rejected": "Pausing withdrawals or claims (a pause would become a lock or a claim denial)."
        },
        {
          "function": "`unpause()`",
          "caller": "guardian",
          "whatAndWhy": "Ends a pause early; reverts `InvalidParam(\"notPaused\")` when nothing is paused. The cooldown runs from the actual end (D-41).",
          "enforces": [
            "T-25"
          ],
          "rejected": ""
        },
        {
          "function": "`isPausedNew()`",
          "caller": "anyone (view)",
          "whatAndWhy": "Read by escrows before deposits.",
          "enforces": [
            "T-25"
          ],
          "rejected": ""
        },
        {
          "function": "`createCampaign(...)`",
          "caller": "anyone; caller becomes the protocol",
          "whatAndWhy": "Validates terms, clones six contracts and initialises them atomically, checks the declared terms hash.",
          "enforces": [
            "F-02",
            "T-08",
            "D-01"
          ],
          "rejected": "Two-step deploy-then-initialise (front-running `initialize`); mutable draft terms (auditors could sign one draft and be bound by another)."
        },
        {
          "function": "`getCampaign(id)`, `campaignCount()`",
          "caller": "anyone (view)",
          "whatAndWhy": "Discovery.",
          "enforces": [],
          "rejected": ""
        },
        {
          "function": "`getVersion(v)`, `versionCount()`, `predictClone(v, id, kind)`",
          "caller": "anyone (view)",
          "whatAndWhy": "Implementation sets and the deterministic clone address of each campaign contract before creation (salt `keccak256(abi.encode(id, kind))`).",
          "enforces": [
            "D-01"
          ],
          "rejected": ""
        },
        {
          "function": "`tokenAllowed`, `guardian`, `pausedUntil`, `lastPauseEnd`, `MAX_PAUSE`, `MAX_SOURCE_URI`, `PAUSE_COOLDOWN`",
          "caller": "anyone (view)",
          "whatAndWhy": "Public state and limits of the admin powers.",
          "enforces": [
            "T-25",
            "F-02"
          ],
          "rejected": ""
        },
        {
          "function": "`transferOwnership`, `acceptOwnership`, `renounceOwnership`, `owner`, `pendingOwner`",
          "caller": "owner / pending owner",
          "whatAndWhy": "OpenZeppelin `Ownable2Step`. The owner's powers reach only future campaigns (new versions, allowlist, guardian), so a transfer or renouncement cannot touch any campaign (ADV-13).",
          "enforces": [
            "T-15"
          ],
          "rejected": "Single-step transfer (a typo hands the role to an unusable address)."
        }
      ]
    },
    {
      "name": "AuditCommitmentRegistry",
      "library": false,
      "purpose": "Exists to be the single, immutable statement of what was reviewed and under which terms, and to switch coverage off when the reviewed code changes. Holds no funds.",
      "functions": [
        {
          "function": "`initialize(...)`",
          "caller": "factory, once",
          "whatAndWhy": "Stores terms, computes the terms hash, observes every identity entry. A campaign cannot be created for code that already differs from its commitment.",
          "enforces": [
            "T-08",
            "ADV-16",
            "T-02"
          ],
          "rejected": "Trusting declared codehashes without observing them."
        },
        {
          "function": "`activate()`",
          "caller": "anyone",
          "whatAndWhy": "Ends enrolment: checks participation, vault funding and identity. Drift before activation, or any stamp made during enrolment, cancels and refunds (D-33). StaticCall probes run with a gas guard (`ACTIVATION_PROBE_GAS`), so only a probe that fails with full gas counts as drift (D-32).",
          "enforces": [
            "T-02",
            "T-05",
            "ADV-05"
          ],
          "rejected": "Automatic activation on first claim (would let the claimant choose the timing); stamping drift found at activation (the time of change is unknown, so coverage never reliably started)."
        },
        {
          "function": "`attestChange(entry)`",
          "caller": "anyone",
          "whatAndWhy": "Stamps the first observed mismatch of one identity entry and returns `true` only in that call (D-36). Coverage for incidents at or after the stamp ends.",
          "enforces": [
            "T-02",
            "C-07",
            "ADV-05",
            "ADV-06"
          ],
          "rejected": "Reading EIP-1967 slots (impossible on-chain without proofs, U-01); a keeper or oracle role (a trusted party who could stamp falsely); automatic penalty or cancellation on change (would erase claims for earlier incidents)."
        },
        {
          "function": "`observe(entry)`",
          "caller": "anyone (view)",
          "whatAndWhy": "Lets anyone see what the contract would compare.",
          "enforces": [
            "T-05"
          ],
          "rejected": ""
        },
        {
          "function": "`coverageEndBlock(addrIndex)`",
          "caller": "anyone (view)",
          "whatAndWhy": "First drift block that ends coverage for an address.",
          "enforces": [
            "C-07"
          ],
          "rejected": ""
        },
        {
          "function": "`verifyLeaf(leaf, proof)`",
          "caller": "anyone (view)",
          "whatAndWhy": "Proves a function is in scope for the reviewed code version.",
          "enforces": [
            "T-01",
            "ADV-01"
          ],
          "rejected": "Storing selector lists on-chain (costly, no per-auditor units); free-text scope (the source of disputes)."
        },
        {
          "function": "`isExcluded(leafHash, proof)`",
          "caller": "anyone (view)",
          "whatAndWhy": "Proves a leaf is explicitly excluded.",
          "enforces": [
            "T-01",
            "C-19"
          ],
          "rejected": "Non-membership proofs for plain Merkle trees (not possible without sorted trees and adjacency proofs; more complex for the same result)."
        },
        {
          "function": "getters (`terms`, `termsHash`, `phase`, `claimDeadline`, `coverageStart`, `tClaim`, `createdBlock`, `activatedAt`, `activatedBlock`, `panel`, `appealPanel`, `isRosterMember`, `coveredCount`, `coveredAt`, `identityCount`, `identityAt`, `driftBlock`, `driftTime`, `TERMS_TYPEHASH`, `ACTIVATION_PROBE_GAS`)",
          "caller": "anyone (view)",
          "whatAndWhy": "Transparency for auditors before signing and for the demo; `isRosterMember` is the C-22 check used by the escrow.",
          "enforces": [
            "A-03",
            "C-22"
          ],
          "rejected": ""
        }
      ]
    },
    {
      "name": "BondEscrow",
      "library": false,
      "purpose": "Exists to hold each campaign's principal with explicit ledgers, so that only signed consent creates liability and only final rulings move capital.",
      "functions": [
        {
          "function": "`initialize(id, siblings)`",
          "caller": "factory, once",
          "whatAndWhy": "Binds the clone to its campaign and copies the terms (every clone has the same `initialize`; D-37).",
          "enforces": [
            "ARCH §7"
          ],
          "rejected": "Separate deploy and initialise transactions (front-running)."
        },
        {
          "function": "`enrol(e, sig)`",
          "caller": "anyone (relayer) with the auditor's EIP-712 / ERC-1271 signature",
          "whatAndWhy": "Records the auditor's own units and shared-liability choice and takes the bond from the signer (the only `transferFrom` whose `from` is not `msg.sender`; the signature covers campaign, terms hash, amount, nonce and deadline).",
          "enforces": [
            "T-07",
            "T-19",
            "F-10",
            "INV-09"
          ],
          "rejected": "`msg.sender`-only enrolment without signatures (no portable proof of consent; no contract wallets); party-declared conflict masks at enrolment (let an auditor block the panel, T-11)."
        },
        {
          "function": "`topUp(t, sig)`",
          "caller": "anyone with signature",
          "whatAndWhy": "Adds principal during enrolment under the same terms.",
          "enforces": [
            "F-10",
            "T-03"
          ],
          "rejected": "Top-ups after activation (would change exposure mid-term without the other side's view)."
        },
        {
          "function": "`reserveFor(claimId, unit, target)`",
          "caller": "own ClaimRegistry",
          "whatAndWhy": "Holds capital for a claim at filing, primary layer first. Stores the consent-based L1/L2 sets (D-34) and clamps to the aggregate cap left (D-35).",
          "enforces": [
            "F-20..F-23",
            "T-10",
            "ADV-09",
            "INV-10"
          ],
          "rejected": "Computing shares only at settlement (two claims could both count the same capital)."
        },
        {
          "function": "`refreshReservation(claimId, target)`",
          "caller": "own ClaimRegistry",
          "whatAndWhy": "Adds capital freed by other claims.",
          "enforces": [
            "F-23"
          ],
          "rejected": "Re-reserving automatically on every release (unbounded loops over claims)."
        },
        {
          "function": "`settleClaim(claimId, payout, mask, recipient)`",
          "caller": "own ClaimRegistry",
          "whatAndWhy": "Waterfall payout, release of the rest, credit to the beneficiary.",
          "enforces": [
            "F-26..F-28",
            "INV-03",
            "INV-04"
          ],
          "rejected": "Paying the full claim from whoever has capital (forced shared liability, T-19)."
        },
        {
          "function": "`releaseClaim(claimId)`",
          "caller": "own ClaimRegistry",
          "whatAndWhy": "Releases everything for rejected or expired claims.",
          "enforces": [
            "F-29"
          ],
          "rejected": ""
        },
        {
          "function": "`withdrawPrincipal(to)`",
          "caller": "auditor",
          "whatAndWhy": "Returns free principal after maturity or cancellation.",
          "enforces": [
            "T-18",
            "ADV-17",
            "INV-08"
          ],
          "rejected": "Withdrawal at coverage end (claims in the tail would find no capital); admin-released withdrawal (an admin path)."
        },
        {
          "function": "`withdrawCredit(to)`",
          "caller": "credit holder",
          "whatAndWhy": "Pull payment of payouts to any address the holder chooses.",
          "enforces": [
            "T-17",
            "ADV-15"
          ],
          "rejected": "Push transfer at settlement."
        },
        {
          "function": "`exposureOf(leaf, proof)`",
          "caller": "anyone (view)",
          "whatAndWhy": "Shows who stands behind a function now and whether its code drifted.",
          "enforces": [
            "Added idea 6"
          ],
          "rejected": "An off-chain index only (not verifiable by a wallet)."
        },
        {
          "function": "`headroomOf`, `positionOf`, `isMatured`, `reservationOf`, `reservedOfMask`, `claimReservation`, `nonces`, `usedDigest`, `auditorCount`, `auditorAt`, `credits`, totals (`totalDeposited`, `totalAvailable`, `totalReserved`, `totalPaid`, `totalWithdrawn`, `totalCredits`, `totalCreditWithdrawn`)",
          "caller": "anyone (view)",
          "whatAndWhy": "Transparency, the invariant checks and the demo. `positionOf` shows live `original`/`limit` until the lazy activation freeze (D-27).",
          "enforces": [
            "INV-02",
            "INV-04",
            "INV-09"
          ],
          "rejected": ""
        },
        {
          "function": "`enrolmentDigest`, `topUpDigest`, `domainSeparator`, `eip712Domain`, `ENROLMENT_TYPEHASH`, `TOPUP_TYPEHASH`",
          "caller": "anyone (view)",
          "whatAndWhy": "Lets wallets and relayers build exactly the digest the escrow checks.",
          "enforces": [
            "T-07"
          ],
          "rejected": ""
        }
      ]
    },
    {
      "name": "ClaimRegistry",
      "library": false,
      "purpose": "Exists to run each claim through bounded, permissionless steps so that no claim can be paid without a quorum ruling and none can be held open forever.",
      "functions": [
        {
          "function": "`initialize(id, siblings)`",
          "caller": "factory, once",
          "whatAndWhy": "As for the escrow.",
          "enforces": [
            "ARCH §7"
          ],
          "rejected": ""
        },
        {
          "function": "`file(args)`",
          "caller": "claimant",
          "whatAndWhy": "Mechanical checks first (scope, version, window, drift, duplicates), then reservation, case opening, and the deposit pull last.",
          "enforces": [
            "C-01..C-11",
            "T-01",
            "T-02",
            "T-09"
          ],
          "rejected": "Open filing by anyone (spam and griefing of reservations); filing with exploit details on-chain (helps copycats)."
        },
        {
          "function": "`provideEvidence(claimId, hash)`",
          "caller": "claimant",
          "whatAndWhy": "Lets a claimant meet the filing deadline before the evidence bundle is final.",
          "enforces": [
            "C-12",
            "ADV-20"
          ],
          "rejected": "Requiring evidence at filing (pushes claimants to file incomplete bundles)."
        },
        {
          "function": "`expireEvidence(claimId)`",
          "caller": "anyone",
          "whatAndWhy": "Ends claims that never got evidence.",
          "enforces": [
            "C-13"
          ],
          "rejected": ""
        },
        {
          "function": "`addEvidence(claimId, hash)`",
          "caller": "claimant or affected auditor",
          "whatAndWhy": "Public record of supplementary evidence.",
          "enforces": [
            "C-16"
          ],
          "rejected": ""
        },
        {
          "function": "`respond(claimId, hash)`",
          "caller": "affected auditor",
          "whatAndWhy": "Guarantees the auditor's right to answer before any vote.",
          "enforces": [
            "C-17"
          ],
          "rejected": ""
        },
        {
          "function": "`refreshReservation(claimId)`",
          "caller": "anyone",
          "whatAndWhy": "Lets a later claim use freed capital.",
          "enforces": [
            "F-23"
          ],
          "rejected": ""
        },
        {
          "function": "`rejectExcluded(claimId, proof)`",
          "caller": "anyone",
          "whatAndWhy": "Rejects explicitly excluded claims without a vote.",
          "enforces": [
            "C-19",
            "T-01"
          ],
          "rejected": "Leaving exclusions to the panel (wastes a case on a mechanical question)."
        },
        {
          "function": "`onVotingStarted(claimId)`",
          "caller": "own ArbitrationPanel",
          "whatAndWhy": "Status bookkeeping.",
          "enforces": [
            "C-26"
          ],
          "rejected": ""
        },
        {
          "function": "`recordRuling(...)`",
          "caller": "own ArbitrationPanel",
          "whatAndWhy": "The only first-instance path to `Approved`/`Rejected`.",
          "enforces": [
            "T-14",
            "ADV-12",
            "INV-06"
          ],
          "rejected": ""
        },
        {
          "function": "`onStalled(claimId)`",
          "caller": "own ArbitrationPanel",
          "whatAndWhy": "Applies the pre-agreed fallback.",
          "enforces": [
            "C-30",
            "ADV-10"
          ],
          "rejected": "Indefinite waiting."
        },
        {
          "function": "`appeal(claimId, hash)`",
          "caller": "affected auditor (against approval) or claimant (against rejection)",
          "whatAndWhy": "One bounded appeal with a deposit.",
          "enforces": [
            "C-31",
            "T-12"
          ],
          "rejected": "Appeals by the protocol or a platform (unilateral power)."
        },
        {
          "function": "`recordAppealRuling(...)`",
          "caller": "own AppealPanel",
          "whatAndWhy": "The only path from `Appealed` to `Final`.",
          "enforces": [
            "C-33",
            "C-34",
            "T-14"
          ],
          "rejected": ""
        },
        {
          "function": "`onAppealStalled(claimId)`",
          "caller": "own AppealPanel",
          "whatAndWhy": "Applies the pre-agreed appeal timeout.",
          "enforces": [
            "C-35",
            "ADV-11"
          ],
          "rejected": ""
        },
        {
          "function": "`finalize(claimId)`",
          "caller": "anyone",
          "whatAndWhy": "Makes an unappealed ruling final after the window.",
          "enforces": [
            "C-36",
            "ADV-12"
          ],
          "rejected": "Auto-finalising inside `settle` (blurs the audit trail of statuses the spec requires)."
        },
        {
          "function": "`settle(claimId)`",
          "caller": "anyone",
          "whatAndWhy": "Executes the final ruling once.",
          "enforces": [
            "C-37",
            "INV-03",
            "INV-07"
          ],
          "rejected": "Settlement by the claimant only (could delay release of auditors' capital)."
        },
        {
          "function": "`withdrawCredit(to)`",
          "caller": "credit holder",
          "whatAndWhy": "Pull payment of deposit refunds and forfeits.",
          "enforces": [
            "T-17"
          ],
          "rejected": ""
        },
        {
          "function": "views (`getClaim`, `openClaims`, `claimCount`, `isParty`, `incidentUsed`, `credits`, `heldDeposits`, `totalCredits`, `totalCreditWithdrawn`)",
          "caller": "anyone",
          "whatAndWhy": "Transparency; maturity check; F-16.",
          "enforces": [
            "INV-08",
            "F-16"
          ],
          "rejected": ""
        },
        {
          "function": "`maxApprovable(claimId, mask)`",
          "caller": "anyone (view)",
          "whatAndWhy": "The C-27 bound both panels validate ballots against: `min(claimedLoss − otherRecovery, claimLimit, reserved − reservedOf(mask))`.",
          "enforces": [
            "C-27",
            "T-12",
            "ADV-04"
          ],
          "rejected": ""
        }
      ]
    },
    {
      "name": "ArbitrationPanel",
      "library": false,
      "purpose": "Exists so that a decision is always reached by a fixed, consented roster, or the claim ends by a pre-agreed rule, and so that no party can stall it.",
      "functions": [
        {
          "function": "`initialize(id, siblings)`",
          "caller": "factory, once",
          "whatAndWhy": "Copies the terms and the roster from the registry.",
          "enforces": [
            "ARCH §7"
          ],
          "rejected": ""
        },
        {
          "function": "`openCase(claimId)`",
          "caller": "own ClaimRegistry",
          "whatAndWhy": "Seats the first five roster members. Round-1 times follow the claim's response deadline (`caseOf` reports them).",
          "enforces": [
            "C-20"
          ],
          "rejected": "Random selection (no secure on-chain randomness; harder to audit)."
        },
        {
          "function": "`challenge(claimId, member, hash)`",
          "caller": "party, budget per side",
          "whatAndWhy": "Removes a member a party objects to, with evidence on record.",
          "enforces": [
            "C-24",
            "C-25",
            "T-11",
            "ADV-03"
          ],
          "rejected": "Unlimited challenges (blocks the panel); on-chain judgement of conflicts (impossible)."
        },
        {
          "function": "`recuse(claimId, reason)`",
          "caller": "roster member",
          "whatAndWhy": "A member's own conflict is always respected.",
          "enforces": [
            "C-23"
          ],
          "rejected": ""
        },
        {
          "function": "`castVote(...)`",
          "caller": "seated member",
          "whatAndWhy": "Reasoned, bounded ballot; fee credited regardless of ballot.",
          "enforces": [
            "C-27",
            "T-12",
            "T-29"
          ],
          "rejected": "Simple yes/no with amount fixed at filing (no partial approval); fees as a share of the payout (outcome-dependent pay)."
        },
        {
          "function": "`closeVoting(claimId)`",
          "caller": "anyone",
          "whatAndWhy": "Tally with the \"largest amount a quorum supports\" rule, replacement round (`now + voteExtension`, D-39), fallback; stalls at once when fewer seats than the quorum are filled (D-42).",
          "enforces": [
            "C-28",
            "C-30",
            "ADV-10"
          ],
          "rejected": "Average or median amount (one extreme ballot moves the result); closing at the first 3 matching ballots (lets a fast majority shut out the remaining members' amounts)."
        },
        {
          "function": "views (`seatedOf`, `ballotOf`, `caseOf`, `roster`)",
          "caller": "anyone",
          "whatAndWhy": "Seating and ballots are public.",
          "enforces": [
            "INV-06"
          ],
          "rejected": ""
        }
      ]
    },
    {
      "name": "AppealPanel",
      "library": false,
      "purpose": "Exists as a separate authority that can uphold, reverse or reduce, never exceed, and that ends by a pre-agreed rule.",
      "functions": [
        {
          "function": "`initialize(id, siblings)`",
          "caller": "factory, once",
          "whatAndWhy": "Copies the terms and the appeal roster.",
          "enforces": [
            "ARCH §7"
          ],
          "rejected": ""
        },
        {
          "function": "`openAppeal(claimId, mode)`",
          "caller": "own ClaimRegistry",
          "whatAndWhy": "Seats the appeal roster; escalation mode for stalled panels.",
          "enforces": [
            "C-32",
            "C-30"
          ],
          "rejected": "Same roster as the panel (no independent check)."
        },
        {
          "function": "`challenge`, `recuse`",
          "caller": "party / member",
          "whatAndWhy": "As in the panel.",
          "enforces": [
            "C-24",
            "C-23"
          ],
          "rejected": ""
        },
        {
          "function": "`castVote(...)`",
          "caller": "seated member",
          "whatAndWhy": "Ballots bounded by signed limits and, on an auditor's appeal, by the first-instance amount.",
          "enforces": [
            "C-33"
          ],
          "rejected": "Appeal panel able to raise amounts on an auditor's appeal (punishes appealing)."
        },
        {
          "function": "`closeVoting(claimId)`",
          "caller": "anyone",
          "whatAndWhy": "Tally with quorum 2, extension, timeout rule.",
          "enforces": [
            "C-34",
            "C-35",
            "ADV-11"
          ],
          "rejected": "Infinite appeal (no finality)."
        },
        {
          "function": "views (`seatedOf`, `ballotOf`, `caseOf`, `roster`)",
          "caller": "anyone",
          "whatAndWhy": "As in the panel.",
          "enforces": [
            "INV-06"
          ],
          "rejected": ""
        }
      ]
    },
    {
      "name": "SettlementEngine",
      "library": true,
      "purpose": "Exists so that all money arithmetic is pure, small and fuzzable in isolation.",
      "functions": [
        {
          "function": "`boundPayout(approved, eligibleLoss, claimLimit, reservedNonExcluded, aggregateRemaining)`",
          "caller": "",
          "whatAndWhy": "Minimum of all five F-26 bounds (D-29).",
          "enforces": [
            "F-26"
          ],
          "rejected": "Spreading bound checks across contracts."
        },
        {
          "function": "`headroom`",
          "caller": "",
          "whatAndWhy": "Free liability per auditor.",
          "enforces": [
            "F-12"
          ],
          "rejected": ""
        },
        {
          "function": "`allocate`",
          "caller": "",
          "whatAndWhy": "Largest-remainder pro-rata with deterministic ties; exact sums.",
          "enforces": [
            "F-25",
            "INV-02"
          ],
          "rejected": "Floor-only (leaves dust unallocated and payout short); \"last auditor gets the remainder\" (biases against one auditor, can exceed their weight)."
        },
        {
          "function": "`waterfall`",
          "caller": "",
          "whatAndWhy": "Primary layer first, shared layer only for the remainder.",
          "enforces": [
            "F-22",
            "F-27",
            "T-19"
          ],
          "rejected": "Pro-rata across all auditors (forces shared liability)."
        },
        {
          "function": "`kthLargest`",
          "caller": "",
          "whatAndWhy": "Ruling amount rule.",
          "enforces": [
            "C-28"
          ],
          "rejected": ""
        }
      ]
    },
    {
      "name": "RewardsVault",
      "library": false,
      "purpose": "Exists to keep every non-principal payment (rewards, disclosure rewards, adjudicator fees) in a separate, prefunded contract with fixed formulas.",
      "functions": [
        {
          "function": "`initialize(id, siblings)`",
          "caller": "factory, once",
          "whatAndWhy": "As for the escrow.",
          "enforces": [
            "ARCH §7"
          ],
          "rejected": ""
        },
        {
          "function": "`fund()`",
          "caller": "protocol",
          "whatAndWhy": "Prefunds all budgets before anyone bonds; accepted from creation until `enrolEnd` (D-40).",
          "enforces": [
            "F-31"
          ],
          "rejected": "Paying rewards later from protocol revenue (auditors would bond on a promise)."
        },
        {
          "function": "`isFunded()`",
          "caller": "anyone (view)",
          "whatAndWhy": "Enrolment gate.",
          "enforces": [
            "F-31"
          ],
          "rejected": ""
        },
        {
          "function": "`claimReward(to)`",
          "caller": "auditor",
          "whatAndWhy": "Fixed reward on the original bond at maturity.",
          "enforces": [
            "F-32",
            "F-33"
          ],
          "rejected": "Reward reduced by payouts (makes reporting an incident costlier for the auditor)."
        },
        {
          "function": "`refundUnused()`",
          "caller": "anyone",
          "whatAndWhy": "Returns unused budgets to the protocol under fixed rules; reverts `NothingToWithdraw` when it credits nothing (D-42).",
          "enforces": [
            "F-32",
            "F-37",
            "F-39"
          ],
          "rejected": "Admin sweep (an admin path)."
        },
        {
          "function": "`commitDisclosure(c)`",
          "caller": "enrolled auditor",
          "whatAndWhy": "Hidden, timestamped disclosure.",
          "enforces": [
            "C-39",
            "T-23"
          ],
          "rejected": "Public disclosure at commit (leaks the bug location)."
        },
        {
          "function": "`markFixed(id)`",
          "caller": "protocol",
          "whatAndWhy": "Allows early reveal after a fix.",
          "enforces": [
            "F-35"
          ],
          "rejected": ""
        },
        {
          "function": "`revealDisclosure(...)`",
          "caller": "committing auditor",
          "whatAndWhy": "Proves the leaf and the auditor's unit after embargo, fix or open claim.",
          "enforces": [
            "F-35",
            "T-22"
          ],
          "rejected": ""
        },
        {
          "function": "`rejectDisclosure(id, reason)`",
          "caller": "protocol",
          "whatAndWhy": "Public refusal of the reward within the window.",
          "enforces": [
            "F-36",
            "A-10"
          ],
          "rejected": "Panel review of every disclosure (expensive for small rewards)."
        },
        {
          "function": "`claimDisclosureReward(id, to)`",
          "caller": "committing auditor",
          "whatAndWhy": "Auto-accepted reward after the window.",
          "enforces": [
            "F-36"
          ],
          "rejected": "Reward only on explicit protocol approval (silent refusal)."
        },
        {
          "function": "`hasPriorDisclosure(...)`",
          "caller": "anyone (view)",
          "whatAndWhy": "Safe-harbour precondition for ballots.",
          "enforces": [
            "C-41",
            "T-22"
          ],
          "rejected": "Automatic immunity by leaf match (gameable)."
        },
        {
          "function": "`creditAdjudicator(member)`",
          "caller": "own panels",
          "whatAndWhy": "Fixed fee per ballot.",
          "enforces": [
            "F-38",
            "T-29"
          ],
          "rejected": "Fee from the claim deposit or the payout (outcome-dependent)."
        },
        {
          "function": "`withdrawCredit(to)`",
          "caller": "credit holder",
          "whatAndWhy": "Pull payments.",
          "enforces": [
            "T-17"
          ],
          "rejected": ""
        },
        {
          "function": "views (`disclosureOf`, `credits`, `rewardOf`, `rewardClaimed`, `disclosuresBy`, `disclosureCount`, `funded`, `fundedTotal`, buckets `rewardFree`, `rewardCommitted`, `disclosureFree`, `disclosureReserved`, `adjudicationFree`, `totalCredits`, `totalCreditWithdrawn`, flags `rewardsCommitted`, `cancelRefunded`, `disclosuresClosed`)",
          "caller": "anyone",
          "whatAndWhy": "F-17 is checkable from these alone. Every state-changing call first runs the lazy activation commit or cancellation refund (D-27).",
          "enforces": [
            "F-17",
            "INV-01"
          ],
          "rejected": ""
        }
      ]
    }
  ]
}
