Skip to content

About

Sapper's bounty pot, Checker network and settlement contracts. Live on Robinhood Chain, coming to Elysium.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Sapper contracts

ci license

A Sapper bounty pays only for an exploit that staked Checkers have replayed and confirmed. These contracts hold each client's bounty pot, send every claimed finding to Checkers who replay it, and release the bounty once a confirmed finding has been rated and the client's review period has passed. A client's unlocked balance stays withdrawable throughout.

Solidity 0.8.24 against OpenZeppelin 5.4. None of the Sapper contracts is upgradeable. The ERC-8004 identity registry that the deploy scripts create on a chain without one is a UUPS proxy, and Identity registry owner says who holds its upgrade key.

Where they run

Robinhood Chain (chain id 4663): retired. Sapper's services moved to Elysium on 29 November 2026, and new claims are paused here. Pots and earnings stay withdrawable on chain. Bounty pots and Checker stake were in USDG. The deployed contracts were built from tag v1.0.0, deployed at block 117,818,341, and their source is verified on Sourcify.

Contract Address Verified source
SapperScope 0xf026480a540d7cB05Dad60f6d6b9925c37fa0023 source
SapperBountyPot 0x4F1B5280f5B20742f4bab3f4de6a66D89B1c7dDb source
SapperSettlementGate 0xa370f7Ef57772ca1371C7646501028BAedc5e519 source
SapperCheckerNet 0x55457b1EC47755f1ACed7d6CC7c2FA90f173Ed1e source
SapperReceiptLog 0xAE128bCdE8edE30992d76e6047ac2C5A192E8528 source
SapperValidationRegistry 0xa8dd5d305d7359a7C48DCD11bCb7b2F9d47d36d6 source
SapperBurnBuffer 0xa59B550242440E3baCA76639570379088b1f3B73 source

Current settings: review window 72 hours, rating window 7 days, settlement grace 14 days, minimum Checker stake 0.05 USDG. The full record is in deployments/4663.json. The v1.0.0 README describes those contracts as deployed: the dispute resolver decides disputes, Checkers are drawn in the claim's own transaction, and claims carry no bond.

Elysium (chain id 99901): live. The code on main was deployed on 28 November 2026 from commit 3db06be (tag v2.0.0), and its source is verified on Elysium's Blockscout. Bounty pots are in USDC and Checkers stake $SAPR. Sapper's services have run on these contracts since 29 November 2026. Compared with v1.0.0 the code adds claim bonds, a stake-weighted Checker vote on disputes, a Checker draw made in a later block, outside Breaker operators, boosts, fix bonds and a job escrow.

Contract Elysium
SapperScope 0xf026480a540d7cB05Dad60f6d6b9925c37fa0023
SapperBountyPot 0x4F1B5280f5B20742f4bab3f4de6a66D89B1c7dDb
SapperSettlementGate 0xa370f7Ef57772ca1371C7646501028BAedc5e519
SapperCheckerNet 0x55457b1EC47755f1ACed7d6CC7c2FA90f173Ed1e
SapperOperators 0xfe61746B08e95C268Ae60a30F7c8b25Ad3028b81
SapperBoost 0xC8bFff911dC7a02828Ebe22493dBa2e938e90F89
SapperFixBond 0xcfa143f55C71F5b2740C31A4dC03a61B5Fe92bB8
SapperJobs 0x9A40d2CCd0B03Ed953513EC3C0229EA800A99523
SapperReceiptLog 0xAE128bCdE8edE30992d76e6047ac2C5A192E8528
SapperValidationRegistry 0xa8dd5d305d7359a7C48DCD11bCb7b2F9d47d36d6
SapperBurnBuffer 0xa59B550242440E3baCA76639570379088b1f3B73
ERC-8004 identity registry 0x7c3E95746A7f595CB2926059DFafAA4bC6307206
Treasury (Safe) 0xD295ac4a8BA16c047fa7093200d909482db9C3cf

The suite has the same addresses as on Robinhood Chain because the same account deployed both from nonce 0. The full record is in deployments/99901.json, with boosts, fix bonds and jobs in 99901.boost.json, 99901.fix-bond.json and 99901.jobs.json. SaprLock is not deployed.

Contracts

Contract What it does Robinhood Chain Elysium
SapperScope Opt-in registry. A client proves control of a target contract once: the target's owner(), admin() or DEFAULT_ADMIN_ROLE holder opts in directly or signs an EIP-712 message (EOA or ERC-1271). Targets on other chains opt in with a signature from the control attester. Each entry stores the invariants root and the disclosure address. Holds no funds. retired (v1.0.0) live
SapperBountyPot The only contract that holds bounty tokens. Keeps every client's unlocked and locked balance, a price table per client, one lock per finding, and the earnings owed to each payee. retired (v1.0.0) live
SapperSettlementGate The finding lifecycle. The only caller of the pot's lock functions and of the Checker net's openRound and openVote. Holds each claim's bond in the Checker net's stake token, records severity, root cause, the worker split and disputes, and posts an ERC-8004 validation response when a finding settles. retired (v1.0.0, without bonds or votes) live
SapperCheckerNet Staked Checkers. Draws 3 to 5 Checkers per finding in proportion to their stake, excluding the Breaker that reported it and the contract's client, and runs a commit and reveal vote on (passed, resultHash); a strict majority of the assigned Checkers decides. A disputed finding gets a second, stake-weighted vote among Checkers who did not replay it. Each draw is requested in one block and made in a later one, seeded by the request block's hash. A finding on a contract its client has not opened draws Sapper-run Checkers only. retired (v1.0.0, without votes or the delayed draw) live
SapperOperators Outside Breaker operators, and each client's switch that opens a contract to them. An operator stakes the Checker net's stake token behind an ERC-8004 agent it owns and can then claim findings itself on opened contracts. It is the one caller besides the keeper that the gate accepts a claim from, and it slashes an operator's stake when the Checkers fail its claim. not deployed live
SapperBoost Anyone can lock $SAPR on a contract to raise its bounty. A settled finding pays part of the boost to the agents that proved it; without a finding, the booster withdraws after a notice period. not deployed live
SapperFixBond A client locks $SAPR behind a public promise to fix confirmed findings within a deadline it picks. A fix proven by replay inside the deadline costs nothing; a late one forfeits part of the bond to the treasury. not deployed live
SapperJobs ERC-8183 escrow for hiring a one-off scan. The client funds the job; the evaluator completes it, paying the full budget to the treasury with no fee, or rejects it and the client is refunded. not deployed live
SaprLock Team $SAPR on a public vesting schedule (OpenZeppelin VestingWalletCliff). Nothing vests before the cliff, nothing can revoke the schedule, and anyone can release vested tokens to the beneficiary. not deployed not deployed
SapperBurnBuffer Receives 5% of every settlement as pot earnings and holds it until its owner releases it. retired (v1.0.0) live
SapperValidationRegistry Minimal ERC-8004 validation registry bound to an existing identity registry. retired (v1.0.0) live
SapperReceiptLog Write-once log of one Merkle root of step receipts per scan job. retired (v1.0.0) live

vendor/erc-8004 holds the ERC-8004 reference identity registry from erc-8004/erc-8004-contracts, under its own licence. The deploy scripts deploy it behind its UUPS proxy on chains that have no identity registry yet.

The rest of this file describes the code on main.

Finding lifecycle

stateDiagram-v2
    [*] --> None
    None --> Claimed: claim by keeper or operator
    Claimed --> Confirmed: Checker majority passes the replay
    Claimed --> Rejected: replay fails or no majority
    Confirmed --> Review: rate by keeper
    Confirmed --> Rejected: rate finds a duplicate root cause
    Review --> Disputed: dispute by client before reviewEndsAt
    Disputed --> Review: Checker vote keeps or lowers severity
    Disputed --> Rejected: Checker vote confirms a duplicate
    Disputed --> Review: resolver keeps or lowers, only after a vote without quorum
    Disputed --> Rejected: resolver rejects, only after a vote without quorum
    Review --> Settled: settle by anyone after reviewEndsAt
    Claimed --> Expired: reclaimExpired
    Confirmed --> Expired: reclaimExpired
    Review --> Expired: reclaimExpired
    Disputed --> Expired: reclaimExpired
    Settled --> [*]
    Rejected --> [*]
    Expired --> [*]
Loading

SapperSettlementGate.Status encodes these states as None = 0 through Expired = 7 in the order None, Claimed, Confirmed, Review, Disputed, Settled, Rejected, Expired.

What each transition does to the finding's lock in the pot:

Transition Lock
claim Locks min(price(table, bonded severity), unlocked) for the target's client and freezes the client's table into the lock. Expires at now + ratingWindow.
Replay fails or no majority Released in full to the client's unlocked balance in the same transaction.
rate Severity is capped at the bonded severity. Reduced to min(price(terms, severity), current lock). The difference returns to the client. Expiry moves to reviewEndsAt + settleGrace.
rate, duplicate root cause Released in full.
Vote or resolve, lower severity Reduced to min(price(terms, finalSeverity), current lock). The difference returns to the client. The review period ends at once, so the finding is settleable.
Vote or resolve, duplicate Released in full. The root cause becomes available to a later finding.
Vote or resolve, keep Unchanged. The review period ends at once, so the finding is settleable.
settle Credited to the payees as earnings.
reclaimExpired Returned to the client's unlocked balance.

A finding is a duplicate when an earlier finding with the same client, target, chain id and root cause hash was rated and has not been rejected through a dispute.

Reference

  • Severity: Low = 0, Medium = 1, High = 2, Critical = 3. Price and bond tables list the tiers the other way round, Critical first, as in setTable((crit, high, med, low)).
  • Ruling: Keep = 0, Lower = 1, Duplicate = 2, the ballots of a dispute vote.
  • claim is on SapperSettlementGate, called by the keeper or, for an outside operator, by SapperOperators: claim(findingId, target, chainId, forkBlock, bundleHash, breakerOperator, agentId, tier).
    • forkBlock is the block of chainId the reproduction forks from. The gate records it on the finding and in FindingClaimed.
    • agentId is the Breaker's ERC-8004 agent. Zero means none, and the settlement then posts no validation response.
    • tier sets the round size: 0, 1 or 2 draws 3, 4 or 5 Checkers.
  • settle(findingId) and reclaimExpired(findingId) are on SapperBountyPot, not the gate. Anyone may call them.

Money flow

  1. Fund. A client calls fund(amount) after an ERC-20 approval, or fundWithPermit with an EIP-2612 signature. The amount joins the client's unlocked balance.

  2. Price. setTable((crit, high, med, low)) sets the client's prices in token units. It takes one tuple, so its signature is setTable((uint128,uint128,uint128,uint128)). Each price must be at most the one above it. Without a custom table the defaults are 10,000, 2,500, 500 and 0 dollars of the six-decimal stablecoin the pot holds. A client paying 20,000 for a Critical finding, 5,000 for High, 1,000 for Medium and nothing for Low sends:

    cast send <pot> "setTable((uint128,uint128,uint128,uint128))" "(20000000000,5000000000,1000000000,0)" \
      --rpc-url <rpc url> <client signer flags>
  3. Provisional lock. When a finding is claimed, the gate locks the client's price for the severity the Breaker bonded, capped by the unlocked balance at that moment. A client cannot withdraw a locked amount, so funds cannot leave between claim and rating. Claims lock in the order they arrive.

  4. Replay. The drawn Checkers commit, then reveal. Anyone can call finalize once every Checker has revealed or the reveal window has closed. A failed or undecided replay releases the lock immediately.

  5. Rate. The keeper sets severity, root cause and the worker split. The lock can only go down: it is priced against the table frozen at claim, never re-reads the unlocked balance, and the excess returns to the client at once. Rating opens a review period of reviewWindow (72 hours by default).

  6. Review. During the review period the client can dispute once, claiming a lower severity or a duplicate. Staked Checkers vote on it (see Disputes); the dispute resolver decides only when that vote has no quorum.

  7. Settle. After the review period, and before the lock expires, anyone can call settle. The pot makes no transfers here. It credits earnings:

    • 80% to the workers, split by their basis points;
    • 5% shared equally by the Checkers that formed the majority;
    • 5% to the burn buffer;
    • 10% to the treasury, plus every rounding remainder, so the credits sum exactly to the lock.

    A 10,000 dollar lock with a 70/30 worker split and three consensus Checkers credits 5,600 and 2,400 to the workers, 166.666666 to each Checker, 500 to the burn buffer and 1,000.000002 to the treasury.

  8. Withdraw earnings. Each payee calls withdrawEarnings(amount) for its own credit, paid to its own address. The burn buffer's owner calls collect(pot) to pull the buffer's credit.

  9. Reclaim. Once a lock passes its expiry, anyone can call reclaimExpired and the amount returns to the client. An unrated claim expires ratingWindow (7 days by default) after the claim. A rated finding that is never settled expires settleGrace (14 days by default) after the review period set at rating.

A client can call withdraw(amount) on its unlocked balance at any time.

At every point the pot's token balance equals the sum of all clients' unlocked and locked balances plus all unwithdrawn earnings. Tokens leave the pot only through withdraw and withdrawEarnings.

Disputes

The client calls dispute(findingId, proposedSeverity, duplicateOf, evidenceHash) before reviewEndsAt. A non-zero duplicateOf claims a duplicate; otherwise proposedSeverity must be below the rated severity. evidenceHash commits to what the client submitted and must be non-zero.

  1. Draw. The gate calls openVote in the same transaction. The Checker net draws five Checkers, or three when only three or four are eligible, never one assigned to the finding's replay round, the Breaker operator, the finding's client or a worker in the finding's split. Fewer than three eligible opens nothing and the dispute goes straight to the resolver.
  2. Ballots. Each voter commits keccak256(findingId, checker, ruling, severity, salt) and reveals within the replay round's commit and reveal windows. A ruling is Keep, Lower (to severity) or Duplicate. A ballot counts at most for the client's claim: one beyond it counts as the claim, and lowering to the rated severity or above counts as keep.
  3. Weight. Each voter's weight is its free stake at the draw, capped at WEIGHT_CAP (3) times the minimum stake. The draw uses the same weight.
  4. Outcome. finalizeVote (anyone, once all have revealed or the reveal window has closed) ranks outcomes by what the finding pays and takes the weighted median of the revealed ballots. An exact split of the weight takes the lower side, nearer the client's claim.
  5. Slashing. A voter that never reveals is slashed 10%. When the winning ballot holds more than half the revealed weight, every voter that revealed something else is slashed 10% too. Strikes and removal work as for replay rounds.
  6. Quorum. Fewer than three reveals is no quorum. The dispute moves to Fallback and the dispute resolver may resolve it until resolverDeadline (resolverWindow after the vote closes, 3 days by default). After that nobody can resolve it, and the lock returns to the client at its expiry.

onDisputeVote never reverts, so a vote always finalizes and releases its Checkers. If the finding expired meanwhile, or its lock is at or past expiry, the ruling is ignored and the refund stands.

Claim bonds

Every claim is backed by a bond from the Breaker operator in the Checker net's stake token.

  • Post. Before the claim the Breaker calls postBond(findingId, severity), which pulls bondFor(severity) from the bond table in force. The gate freezes that table into the bond. claim reverts with NoBond unless the named Breaker operator has a posted bond on that finding id, and the bonded severity caps both the provisional lock and the rating.
  • Defaults. The constructor sets the tiers from the stake token's supply: Critical 0.05%, High 0.02%, Medium 0.005%, Low 0. The owner can set new tiers with setBondTable; each tier must be at most the one above. Changes apply to bonds posted afterwards.
  • Slash. A replay that a majority fails, or a duplicate found at rating, by vote or by the resolver, slashes what is left of the bond. A rating, vote or resolution that lowers the severity slashes the difference between the two tiers' frozen bonds and keeps the rest.
  • Return. Settlement returns what is left. So does a refund at expiry, and a replay round that ended with no majority, because neither established anything against the claim. cancelBond returns a bond no claim used, and releaseBond returns one whose lock the pot refunded without reaching the gate.
  • Custody. Lifecycle steps only credit: returned bonds go to bondCredit[operator], withdrawn with withdrawBondCredit, and slashed bonds accrue in slashedBonds until anyone calls collectSlashedBonds, which sends them to the pot's treasury. The gate's token balance always equals heldBonds + slashedBonds + sum(bondCredit).

Operators

SapperOperators lets anyone claim findings, on the same terms as the keeper's claims, on the contracts whose clients opened them.

  • Open. A contract is closed to outside operators until its client calls setOpen(target, chainId, true). Closed, only the keeper claims on it and its findings draw Sapper-run Checkers only, so a reproduction is seen by the client and by Sapper-run Checkers. Open, registered operators may claim on it and every staked Checker can be drawn, for the keeper's claims too. The switch is bound to the opt-in it was made under: a contract opted out and in again, by the same client or a new one, starts closed. Closing applies to later claims; a round already requested keeps its pool.
  • Register. register(agentId, amount) takes an ERC-8004 agent the caller owns on the identity registry the gate's validation registry reads, and a stake of at least the Checker net's minStake, in the Checker net's stake token. Both the minimum and the exit cooldown are read from the Checker net when they are used, so they follow its settings.
  • Claim. The operator posts its bond at the gate under findingIdOf(operator, bundleHash) and calls claim(target, chainId, forkBlock, bundleHash). The registry checks that the contract is open and that the operator is registered, not leaving, at or above the minimum stake, under maxOpenClaims and still the owner of its agent, then calls the gate with the operator as the Breaker and the smallest round. From there the claim follows the lifecycle above. Because the finding id is derived from the operator's address, nobody can take another operator's id.
  • Close and slash. Once the gate has settled, rejected or expired the finding, anyone calls close(findingId). It frees the operator's claim slot, counts a settled finding, and takes slashBps (10% by default, at most 50%) of the operator's stake when the replay round ended with a majority that failed it. A round without a majority, a duplicate and a lowered severity cost no stake; the gate's bond rules already apply to them. Slashed stake accrues in slashed until anyone calls collectSlashed, which sends it to the Checker net's treasury.
  • Leave. requestUnregister needs every claim closed and starts the Checker net's cooldown, during which the operator cannot claim. unregister returns the whole stake after it. cancelUnregister stops the exit.
  • The whole network. The gate accepts the registry's claims, and reads each contract's switch, only while gate.operators() is the registry. The gate's owner sets it with setOperators; the zero address closes every contract to outside operators without touching open findings. The guardian's pause stops their new claims too.
  • Switch and gate. While gate.operators() is not the registry, isOpen still reports each client's switch, but the gate treats every contract as closed: only the keeper claims, and every round draws Sapper-run Checkers only.

The registry's token balance always equals totalStaked + slashed.

The Checker draw

claim and dispute only request a draw. SapperCheckerNet.openRound and openVote record the round size, the excluded addresses and the number of the block they ran in, and revert or return false when too few Checkers could be drawn. draw(findingId) and drawVote(findingId) make the draw from the next block on, seeded by keccak256(findingId, hash of the request block). Anyone may call them, and the result is the same whoever does and whenever.

  • Why. The request block's hash does not exist while the request executes, so whoever claims cannot evaluate a draw for any finding id or wait for a block that favours it.
  • Block numbers. On an Arbitrum Orbit chain block.number and blockhash follow the parent chain. The Checker net reads the chain's own block number and hashes from ArbSys (arbBlockNumber, arbBlockHash) where it answers, and uses the opcodes elsewhere.
  • Aged-out seed. A block hash is available for 256 blocks. A draw called later than that moves the seed to the current block and has to be called again. Nothing is held meanwhile: no Checker is assigned and the finding's lock keeps its own expiry.
  • Too few Checkers left. If the pool shrank between the request and the draw, the replay round ends without a majority, which releases the lock and returns the bond, and a dispute vote closes without quorum, which hands the dispute to the resolver.
  • Restricted pool. The gate marks a round restricted when the finding's contract is not open at the registry. A restricted round, and a later dispute vote on the same finding, draw only Checkers the Checker net's owner flagged with setSapperRun.

Boosts

SapperBoost lets anyone add to a contract's bounty with $SAPR, and pays it out only for a finding the gate settles.

  • Boost. boost(target, chainId, amount) locks tokens on a contract. The contract does not have to be watched yet; a boost on one that has not opted in waits there as a request. Boosts on one contract join its open round at one share per token.
  • Checkpoint. Right after a claim, anyone (the keeper does) calls checkpoint(findingId). It closes the open round and holds every closed round for that finding, so a boost made after a claim is never liable for it. Once the gate's owner sets the boost with setBoost, every claim checkpoints in its own transaction. A claim that holds less than BOOST_GAS_FLOOR (300,000 gas) at that point reverts with NotEnoughGas, which covers 50 rounds held at once; a pool with more can still be checkpointed by calling checkpoint directly.
  • Pay. Once the gate settles the finding, pay takes a fraction of each held round by severity: Critical all of it, High a quarter, Medium a twentieth, Low nothing. A tenth of that goes equally to the confirming Checkers and the rest to the workers by their shares. A share whose payee is the contract's own client, or its owner or admin, stays with the boosters.
  • Release. A finding the gate rejected or expired frees its rounds. A checkpoint older than maxOpen that never settled can be released by anyone, and one older than twice maxOpen without asking the gate, so nothing the gate does or fails to do keeps boosters locked for good.
  • Leave. requestUnboost starts a notice (7 days by default), after which the booster has an exit window (3 days by default) to withdraw. An unused request lapses and the boost keeps counting.
  • Native distributions. A token that pays native currency to its holders pays it to this contract for the boosted tokens. claimTokenRewards, which anyone may call and which boosts, withdrawals and payouts call first, collects it, together with any native currency sent here directly, and assigns it to boosters in proportion to their boost. collectRewards(target, chainId) passes a booster its share.

There is no owner and no setter. Boosted tokens leave only through withdraw and collect, native currency only through collectRewards, and the token balance always covers everything boosted and owed.

Fix bonds

SapperFixBond turns a client's promise to fix confirmed findings into a bond anyone can read.

  • Bond. The client locks $SAPR with a Critical deadline of 24 hours, 72 hours or 7 days. High findings get twice as long and Medium four times. The promise covers findings disclosed from then on.
  • Fix. The verifier records each fix once a replay has proven it. A fix inside the deadline moves nothing. A late fix forfeits 10% of the bond, plus 10% for each further deadline that elapsed, to at most 50%, sent to the treasury.
  • Exit. requestExit starts a 14-day notice that cannot be shortened or cancelled. Findings disclosed in its first 7 days are still covered. When the notice ends, each covered finding without a recorded fix counts as a miss. If the verifier has not settled a matured exit within 3 days, the client can take the whole bond back alone.

The owner can replace the verifier at any time and set the treasury. The owner also receives what claimTokenRewards collects, and anyone may call it: the distributions the token pays this contract for the bonded tokens, and any native balance the contract holds. The bonded tokens themselves stay where they are.

The verifier can only cite findings the settlement gate has on record for the bonded client, each once, and only after their severity is final. It supplies each finding's disclosedAt and fixedAt itself. The contract checks them only against since <= disclosedAt <= fixedAt <= now, and against the exit's cover window, so within those bounds the verifier decides each forfeit: up to 50% of the remaining bond per cited finding, sent to the treasury. At a matured exit it also names the covered findings still open, and each one forfeits at least 10%.

Guarantees

Guarantee Mechanism Tests
A client's unlocked balance is always withdrawable. withdraw has no pause, no external call other than the token transfer, and no dependency on the gate. testFuzz_unlockedWithdrawAlwaysSucceeds (claims paused, locks open), testFuzz_withdrawWhileOtherFindingsLocked
An expired lock always refunds. reclaimExpired books the refund before notifying the gate and ignores a failing gate. A lock past its expiry cannot be repriced or extended, so a late rating cannot hold it. test_reclaimSurvivesFailingGate, test_expiredLockRefundsByAnyoneAndCannotSettle, test_unratedClaimRefundsAfterRatingWindow, test_unresolvedDisputeExpiresToClient, test_expiredLockCannotBeAdjusted
A failed replay leaves the client exactly whole. Consensus failure releases the full provisional lock in the same transaction. testFuzz_failedReplayLeavesClientWhole (failed, split and silent rounds), test_failedReplayNeverLocksOrPays
Rating and dispute resolution only lower a lock. adjustLock takes min(price, current lock) against the claim-time table. test_rateNeverRaisesProvisionalLock, test_rateLowersLockToSeverityPrice, test_tableChangeAfterClaimDoesNotReprice, test_disputeReRatesDownAgainstFrozenTable, test_adjustLockReturnsDifference
The split is exact. Integer shares with every remainder credited to the treasury. testFuzz_settleSplitsExactly, test_settleExactBpsOnRoundAmount
No payee can block a settlement. settle only credits a ledger. A frozen, blocklisted or rejecting payee withdraws later, and its credit stays intact until then. test_settleNeverBlockedByFrozenOrRejectingPayee, test_settleCreditsFrozenPayeesWhoWithdrawLater
A payee cannot take more than it was credited. withdrawEarnings reverts above earningsOf(msg.sender). testFuzz_withdrawEarningsNeverExceedsCredit
Conservation. Balance equals client balances plus earnings, checked after every call of random fund, claim, consensus, rate, dispute, resolve, settle, withdraw and reclaim sequences on the full contract set, and on the pot alone. SapperSettlementInvariantTest, SapperBountyPotInvariantTest
A refunded claim never blocks its Checker round. The gate accepts a consensus for a finding that already expired, so the round finalizes, Checkers are released and slashing still applies. test_roundStillFinalizesAfterClaimRefunded
The Breaker never checks its own finding. The Breaker operator is excluded from the draw. testFuzz_breakerOperatorNeverDrawn, test_breakerOperatorIsExcludedFromItsRound
A client never checks a finding on its own contract. The finding's client is excluded from its replay draw and its dispute vote. A pool too small without it refuses the claim with NotEnoughCheckers, or hands the dispute to the resolver. testFuzz_theClientIsNeverDrawnForItsOwnTarget, test_theClientNeverVotesOnItsOwnDispute, test_aRoundTheClientWouldHaveFilledIsRefused, test_aDisputeWithTooFewVotersBesidesTheClientGoesToTheResolver
A validation post never blocks a payout. A refused ERC-8004 request is recorded as skipped. test_validationRefusalNeverBlocksSettle
Too little gas cannot skip a validation post or a boost checkpoint. settle and claim revert with NotEnoughGas when the gate holds less than VALIDATION_GAS_FLOOR before the request or BOOST_GAS_FLOOR before the checkpoint. test_noGasLimitSettlesWithoutTheValidationPost, test_theValidationFloorForwardsOneAndAHalfTimesWhatTheReferenceRegistryNeeds, test_noGasLimitClaimsWithoutTheBoostCheckpoint, test_theBoostFloorForwardsEnoughForFiftyHeldRounds
An open vote or an outstanding bond never holds a refund or a withdrawal. The pot never reads the vote or the bond; the gate's vote and bond callbacks never revert and only credit. test_refundAndWithdrawNeverWaitForAnOpenVote, testFuzz_unlockedStaysWithdrawableDuringAVote, testFuzz_refundsIgnoreOutstandingBonds, test_aVoteClosedAfterTheLockExpiredLeavesItToTheRefund
A vote re-locks exactly. A lowered severity moves exactly old - new from locked to unlocked; a duplicate releases all of it. testFuzz_reLockConservesThePot, test_voteReRatesAndSettlesTheNewAmount, test_voteRejectsADuplicateAndReleasesEverything
The vote is the lower weighted median of clamped ballots, and only the minority and the silent are slashed. _median, revealVote clamping and finalizeVote. testFuzz_outcomeIsTheLowerMedianOfClampedBallots, test_evenSplitResolvesTowardTheClaim, test_aWhaleCountsOnlyUpToTheCap, test_noQuorumSlashesOnlyTheSilent
The resolver acts only on a vote without quorum, and only within its window. resolve checks the dispute stage and resolverDeadline. test_noQuorumHandsTheDisputeToTheResolverForItsWindow, test_theResolverCannotActAfterItsWindow
Every bond ends exactly returned or slashed. Bonds only move between held, credit and slashed balances. testFuzz_bondedEqualsReturnedPlusSlashed, invariant_bondsConserved
Stake below the minimum cannot grow the Checker pool that every draw walks. stake admits a new entry only with the minimum free stake, and withdrawStake removes an entry it leaves below the minimum. test_aStakeBelowTheMinimumCannotJoinThePool, test_recyclingOneMinimumThroughManyAccountsLeavesNoEntryBehind, testFuzz_everyPoolEntryHoldsTheMinimum, test_claimAndDrawGasDoNotGrowWithDustOrRecycledStake, test_aCheckerSlashedBelowTheMinimumStillExitsInFull
Checker stake is conserved through votes. Slashed stake moves only to the Checker net's treasury. invariant_checkerStakeConserved, testFuzz_outcomeIsTheLowerMedianOfClampedBallots
Only the keeper and the operator registry can claim, and the registry only for a registered operator at or above the minimum stake. claim checks the caller against keeper and operators; the registry checks registration, stake, open claims and agent ownership. testFuzz_onlyTheKeeperAndTheRegistryReachTheGate, test_onlyTheKeeperAndTheRegistryMayClaimAtTheGate, test_theOwnerOpensAndClosesTheBreakerSide, test_theMinimumFollowsTheCheckerNet, test_anOperatorThatGaveItsAgentAwayCannotClaim
Nobody can occupy another operator's finding id. The id is keccak256(chainId, registry, operator, bundleHash). testFuzz_findingIdsBelongToOneOperator, test_nobodyCanOccupyAnotherOperatorsFindingId
Operator stake is conserved, and only a failed replay majority slashes it. Stake moves only between the operator's record, slashed and the two exits. SapperOperatorsInvariantTest, testFuzz_slashedStakeIsConserved, test_aRoundWithoutAMajorityCostsNoStake, test_aDuplicateCostsTheBondButNoStake
An operator cannot leave with a claim open. requestUnregister reverts while openClaims is non-zero, and a leaving operator cannot claim. test_unregisteringWaitsForOpenClaimsAndTheCheckerCooldown, invariant_recordsAddUp
Nobody can choose the Checkers for a claim by picking its id or its block. The draw is made in a later block from the request block's hash. test_tryingFindingIdsDoesNotChooseTheRound, testFuzz_theDrawDependsOnlyOnTheFindingAndTheSeedBlocksHash, test_aRoundIsRequestedInOneBlockAndDrawnInALaterOne, test_onAnOrbitChainTheSeedIsTheChainsOwnBlockHash, ElysiumDrawForkTest
A draw nobody makes holds no refund and no withdrawal. A requested round or vote assigns no Checker and touches no lock; the lock's own expiry still refunds. test_aRoundNobodyDrewNeverHoldsAWithdrawalOrARefund, test_aVoteNobodyDrewNeverHoldsARefund, test_aSeedBlockThatAgedOutIsReplacedByTheCurrentOne, test_aPoolThatShrankBeforeTheDrawEndsTheRoundWithoutAMajority
A contract its client has not opened is replayed by Sapper-run Checkers only and takes no outside claim. The registry rejects the claim; the gate marks the round restricted; the Checker net skips unflagged Checkers in the draw and in a later vote. test_aClosedContractTakesNoOutsideClaimAndDrawsSapperRunCheckersOnly, test_aRestrictedRoundDrawsOnlySapperRunCheckers, test_aRestrictedFindingsVoteStaysWithSapperRunCheckers, test_withNoRegistryEveryContractIsClosed, test_aContractOptedInAgainStartsClosed, test_onlyTheContractsClientOpensIt
An expired job always refunds. From expiredAt, submit and complete revert and anyone may call claimRefund, which has no owner, pause or hook in its path. testFuzz_refundsCannotBeBlocked, test_expiryLeavesOnlyTheRefund, test_frozenTreasuryCannotBlockRefund, invariant_expiredEscrowIsAlwaysRefundable
Only the evaluator completes a job. complete and the refunding reject check the immutable evaluator. testFuzz_onlyEvaluatorCompletes, invariant_onlyRolesMoveJobs
The provider key never holds a budget. complete transfers to the immutable treasury, never to the provider. test_completeForwardsTheBudgetToTheTreasury, invariant_everyUnitIsAccountedFor, testFuzz_conservation
The escrow holds exactly the open budgets. Funding measures the balance it receives; completion and refunds move the full budget once. invariant_escrowHoldsExactlyOpenBudgets, invariant_everyUnitIsAccountedFor, testFuzz_conservation
Only a target's controller can put it in scope. Control is read from the target or proven by the controller's signature. testFuzz_optIn_rejectsStranger, test_optIn_signatureMustComeFromController, test_remote_attesterCannotBeSkippedWithOwnerEcho
A target's new owner can stop disclosures to the client before it. optOut accepts the recorded client, or anyone the target on this chain names as its controller now. test_aNewControllerOptsAStaleEntryOut, test_theRecordedClientStillOptsOutAfterAHandover, test_controllingTheSameAddressHereDoesNotOptOutARemoteEntry

SapperBoost and SapperFixBond have their own unit, fuzz and invariant suites in test/, and SaprLock its own unit and fuzz tests.

Roles

Each contract except the validation registry, the boost, the job escrow and the team lock has its own Ownable2Step owner. Ownership moves only when the proposed owner accepts it, and renounceOwnership reverts with NoRenounce, so none of them is ever left without an owner. SaprLock's owner is its beneficiary, as in OpenZeppelin's VestingWallet.

Owner

Can:

  • appoint the keeper, the guardian and the dispute resolver on the gate;
  • set or clear the operator registry on the gate, which opens or closes claims by outside operators;
  • set the registry's slashBps (up to 50%) and maxOpenClaims;
  • set ratingWindow (up to 30 days), reviewWindow (up to 30 days), settleGrace (up to 60 days), resolverWindow (up to 14 days), the claim bond tiers and the validation base URI on the gate;
  • pause and unpause new claims;
  • set the treasury and burn buffer addresses that future settlements credit;
  • set the Checker net's treasury for slashed stake, the minimum stake, the unstake cooldown (up to 30 days) and the commit and reveal windows (up to 1 day each);
  • flag the Checkers Sapper runs, which are the only ones drawn for a contract its client has not opened;
  • set the control attester on the scope;
  • collect and release the burn buffer's tokens;
  • set the fix bond's verifier and treasury, and receive what the fix bond's claimTokenRewards collects.

Cannot:

  • move or lock a client's balance;
  • change an existing lock, its expiry or its terms, or an existing bond or its frozen tiers;
  • move or reassign earnings already credited;
  • pause or gate withdraw, withdrawEarnings or reclaimExpired;
  • replace the gate on the pot or the Checker net once it is set, or upgrade a Sapper contract.

Window changes apply to later claims and ratings. Expiries already written into locks do not move.

Identity registry owner

When IDENTITY_REGISTRY is unset, the deploy creates the reference ERC-8004 identity registry behind a UUPS proxy, and its owner can replace the registry's implementation. The deploy hands that key to OWNER in the same run, since the registry has no two-step transfer. Without OWNER, as on Elysium, the deploying account keeps it along with the Sapper contracts.

The registry holds no funds, and a new implementation cannot move tokens held by any Sapper contract. Its ownerOf does decide who may register an operator behind an agent, whether that operator can still claim, and who may open validation requests for an agent. A new implementation could let an account register or claim behind an agent it does not own, or refuse every operator. Settlements do not depend on the registry: a refused validation request is recorded as skipped. Where the deploy uses an existing registry, its own owner holds this key.

Keeper

Can:

  • claim a finding on an in-scope target for a Breaker operator that bonded it, which requests the Checker round and takes the provisional lock;
  • rate a confirmed finding: severity, root cause and a worker split of up to 16 workers whose basis points sum to 10,000;
  • anchor receipt roots in the receipt log.

Cannot:

  • claim without the named Breaker operator's bond, or spend a bond posted by anyone else;
  • lock more than the client's price for the bonded severity, or more than the client's unlocked balance at claim;
  • raise a lock, or rate once the lock has expired;
  • bring a settlement forward: for every caller, settlement waits for the review period and is blocked while a dispute is open;
  • claim while claims are paused or for a target that is not in scope;
  • touch withdrawals, earnings or refunds.

The keeper chooses the severity and the worker split within these limits. The rating is capped at the bonded severity: a higher one is recorded as the bonded severity. The client's recourse is a dispute during the review period.

Operators

A registered operator can claim a finding for itself on a contract its client opened, and nothing else the keeper can do: it cannot rate, name payees or claim for another address. Its claim needs its own bond, an in-scope target and unpaused claims, like the keeper's. The keeper still rates every finding and names the worker split, so an operator relies on the keeper to list it; the claim's breakerOperator is public, and the split of every rated finding can be read from payees.

Guardian

Can pause and unpause new claims. Nothing else: open findings continue, settlements and refunds proceed, and every withdrawal stays available while claims are paused.

Dispute resolver

The fallback when Checkers cannot decide. Can, on a disputed finding whose vote could not open or ended with fewer than three reveals, and only until resolverDeadline: reject it, which releases the full lock, frees the root cause and slashes the bond; keep its severity; or lower it, priced against the claim-time table and capped by the current lock, which slashes the bond's tier difference.

Cannot act while a vote is open or after one decided, after its window, or on a finding that is not disputed. Cannot raise severity. Lowering requires an unexpired lock. Once the lock expires, the amount returns to the client through reclaimExpired.

Clients, Checkers and anyone

  • A client funds its pot, sets its table, withdraws its unlocked balance, opts targets in and out, opens or closes each of them to outside operators, and disputes a rated finding once during its review period. Whoever controls a target on this chain now can also opt it out, so a new owner can stop disclosures to the client before it.
  • A Breaker operator bonds each claim before it is submitted, can cancel a bond no claim used, and withdraws returned bonds.
  • A Checker stakes, commits and reveals in replay rounds and dispute votes. A Checker that votes against the majority or fails to reveal loses 10% of its stake to the Checker net's treasury, and three strikes remove it from the pool. Stake can be withdrawn after the cooldown and only while the Checker has no open round or vote. Joining the pool takes at least the minimum stake. A withdrawal that leaves less than the minimum takes the Checker out of the pool until it stakes back up to it, and what is left can still be withdrawn in full, after a slash too.
  • An operator registers and stakes, bonds and claims its own findings, tops its stake up after a slash, and leaves after the cooldown.
  • Anyone can call draw, drawVote, finalize, finalizeVote, settle, reclaimExpired, releaseBond, collectSlashedBonds, the registry's close and collectSlashed once their conditions hold.

Known properties

  • Checker draw. The seed is the hash of the chain's own block that held the request. A claimant cannot try finding ids or blocks against a hash it already has. What remains: the sequencer builds that block and can influence its hash, and a claimant whose transaction is the only one in its block could try to predict the hash by simulating the block exactly; a wrong prediction costs it the bond and, for an operator, stake. If nobody calls draw for 256 blocks the seed moves to a newer block, so a claimant gains a second draw only when every other caller, the keeper included, stays away that long.
  • Sapper-run flags. The Checker net's owner decides which Checkers count as Sapper-run. A contract that is not open relies on that list being right, and needs at least three flagged, eligible Checkers besides its client for a claim to be accepted.
  • The keeper names the payees. The gate pays the workers the keeper lists at rating. For an operator's finding the keeper lists that operator; the contracts do not enforce it.
  • Concurrent claims share one pot. Each claim locks against the unlocked balance at its own claim time, so a claim made while earlier claims hold the balance can lock less, or nothing. Rating never tops a lock up. A confirmed finding with an empty lock settles as confirmed and unpaid.
  • Frozen payees. Earnings are paid only to the payee's own address. If the token issuer freezes that address, its credit stays in the pot until the freeze lifts; other payees are unaffected.
  • Direct transfers. Tokens sent to the pot without fund are credited to no one and cannot be recovered. The balance then exceeds the tracked total by that amount. The same holds for tokens sent to SapperJobs outside fund.
  • Owner reach. The owner cannot move funds, but it appoints the keeper and the dispute resolver, who decide ratings and dispute outcomes within the limits above.
  • Rating window sizing. ratingWindow has to exceed a full Checker round (commit plus reveal, at most two days) plus the time needed to rate. A claim that is not rated in time refunds to the client. The deploy scripts refuse a RATING_WINDOW under two days.
  • Slashed stake. finalize transfers slashed stake to the Checker net's treasury. If the token freezes that address, rounds with a slash cannot finalize until the owner sets a new treasury.
  • Dispute votes are unpaid. Voters earn nothing extra; the stick is the slash. The settlement's 5% Checker share still goes to the replay majority.
  • Bond token freezes. Bonds are in the Checker net's stake token. If that token freezes an operator or the pot's treasury, their bond credit or collectSlashedBonds waits; no finding, refund or withdrawal does.
  • Expiry before a replay closes. A claim refunded at expiry returns its bond, even if a replay round that would have failed it finalizes later.
  • Sizes. The gate's runtime is 22,315 bytes, 2,261 under the 24,576 limit; the Checker net's is 20,804, with 3,772 left. Operator logic and the per-contract switch live in the registry for that reason: the gate compares the caller with one more address and asks the registry whether a contract is open.
  • Validation posts. The gate posts an ERC-8004 response only when the agent's owner has approved the gate as an operator on the identity registry. Without approval the post is skipped and the settlement completes. A settlement that reaches the post holding less than VALIDATION_GAS_FLOOR (320,000 gas) reverts with NotEnoughGas instead, so a caller cannot skip the post by sending too little gas, and a gas estimate covers it.
  • Job descriptions are public. A SapperJobs description, target address included, is readable on chain like any ERC-8183 job. Only the hash of the sealed report and a salted hash of the verdict are posted.
  • Job payment goes to the treasury. ERC-8183 pays the provider on complete. Sapper's provider is a hot key that only signs submissions, so complete transfers the budget to the immutable treasury instead. PaymentReleased(jobId, provider, amount) is emitted as the standard defines it, followed by PaymentForwarded(jobId, treasury, amount) naming the actual recipient; the provider's balance never changes.
  • Plain tokens only for boosts and bonds. SapperBoost and SapperFixBond assume an ERC-20 without transfer fees or rebasing.

Build and test

Requires Foundry v1.8.1. Dependencies are pinned through Soldeer.

forge soldeer install
forge build
forge test

Fuzz tests run 1,000 cases and invariant tests run 256 sequences of 64 calls, as set in foundry.toml. The deploy tests write their files under out/test-deployments/, so a deployments/31337.json from a local deploy survives forge test. The fork tests in test/fork run against Elysium when ELYSIUM_RPC_URL is set and against Robinhood Chain when RH_RPC_URL is set, and are skipped otherwise:

ELYSIUM_RPC_URL=https://rpc.elysium.kinetiq.xyz forge test --match-path "test/fork/*"

Deployment

script/Deploy.s.sol deploys the eight core contracts (scope, burn buffer, pot, Checker net, gate, receipt log, validation registry and operator registry), connects the pot and the Checker net to the gate, applies optional settings, offers ownership to OWNER when it is set, and writes the addresses and settings to deployments/<chain id>.json. Without IDENTITY_REGISTRY it first deploys the ERC-8004 reference identity registry from vendor/erc-8004 and takes agent id 0, which the gate reads as "no agent".

forge script script/Deploy.s.sol --rpc-url <rpc url> --broadcast <signer flags>
Variable Required Default Meaning
SETTLEMENT_TOKEN yes Bounty token held by the pot.
TREASURY yes Credited 10% of each settlement; receives slashed Checker stake.
KEEPER yes Gate keeper and receipt log keeper.
GUARDIAN yes May pause and unpause new claims.
RESOLVER yes Dispute resolver.
IDENTITY_REGISTRY no a new reference registry ERC-8004 identity registry the validation registry reads.
CONTROL_ATTESTER no zero address Signer for opt-ins of targets on other chains. Zero disables them.
STAKE_TOKEN no SETTLEMENT_TOKEN Checker stake and claim bond token.
MIN_STAKE when STAKE_TOKEN is another token 100000000 when staking the settlement token Minimum free stake to be drawn, in token units.
RATING_WINDOW no 7 days Seconds a provisional lock lasts before rating: at least 2 days, a replay round with both Checker windows at their longest, and at most 30 days.
RESOLVER_WINDOW no 3 days Seconds the dispute resolver has after a vote without quorum, above zero and at most 14 days.
OPEN_OPERATORS no false true sets the registry on the gate at deploy, so registered operators can claim from the start. Otherwise the owner opens them later with setOperators.
OPERATOR_SLASH_BPS no 1000 Share of an operator's stake a failed replay costs, at most 5000.
OPERATOR_MAX_OPEN_CLAIMS no 4 Claims one operator may have open at a time, at least 1.
SAPPER_CHECKERS no none Comma-separated Checker addresses flagged Sapper-run at deploy, each non-zero and named once. Without at least three staked ones, no claim on a closed contract is accepted.
OWNER no deployer Receives a two-step ownership offer for the seven owned contracts, and ownership of an identity registry the deploy creates.
DEPLOYMENT_NAME no chain id Output file name, without .json.
DEPLOYMENTS_DIR no deployments Directory for the output file, under the project root. fs_permissions in foundry.toml lets scripts write under deployments/ and out/test-deployments/.

Every setting is checked before anything is sent. A variable that is set has to parse as its type, so an address one digit short, a list separated by anything but commas, yes for a boolean or 3d for a number stops the deploy, where an unset variable takes its default. A missing required setting stops it with MissingSetting, a zero address for a role or the treasury with ZeroSetting, a number outside the bounds its contract's setter applies with OutOfRange or BelowMinimum, and a token or registry address without code with NotAContract, each naming the variable. The claim bond tiers default to shares of the stake token's supply at deploy, so the deploy refuses a stake token without one. The deployment JSON records the tiers with the bond token, resolverWindow, the registry's address and settings, and whether operators are open.

On Robinhood Chain, USDG is 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 and the ERC-8004 identity registry is 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432.

After deployment:

  • when OWNER is set, it calls acceptOwnership() on SapperScope, SapperBurnBuffer, SapperBountyPot, SapperCheckerNet, SapperSettlementGate, SapperReceiptLog and SapperOperators, and the deploying account owns them until it does;
  • unless the deploy ran with OPEN_OPERATORS=true, the gate's owner calls setOperators(SapperOperators) when clients may start opening contracts to outside operators;
  • the Checker net's owner calls setSapperRun(checker, true) for every Checker Sapper runs that SAPPER_CHECKERS did not name;
  • the owner of each Breaker agent identity calls setApprovalForAll(gate, true) on the identity registry so settlements post validation responses.

On a local chain

test/mocks/Mocks.sol has MockUSDG, a six-decimal token anyone can mint. Mint before the deploy: the claim bonds are shares of the stake token's supply, and a token without one is refused. With anvil on its default port and its first five accounts as deployer, treasury, keeper, guardian and resolver:

export ETH_RPC_URL=http://127.0.0.1:8545
KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # anvil account 0
TOKEN=$(forge create test/mocks/Mocks.sol:MockUSDG --private-key $KEY --broadcast --json | jq -r .deployedTo)
cast send $TOKEN "mint(address,uint256)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000000000000 --private-key $KEY
SETTLEMENT_TOKEN=$TOKEN \
TREASURY=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 \
KEEPER=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC \
GUARDIAN=0x90F79bf6EB2c4f870365E785982E1f101E93b906 \
RESOLVER=0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
  forge script script/Deploy.s.sol --rpc-url $ETH_RPC_URL --broadcast --private-key $KEY

The addresses are written to deployments/31337.json. The mint gives account 0 a million tokens, which puts the Critical claim bond at 500. MockSapr in the same file is an 18-decimal token for the boost and fix bond scripts.

Elysium

script/DeployElysium.s.sol is the Elysium deployment. It settles in Elysium's USDC (0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65, six decimals, EIP-2612 permit), takes $SAPR as the Checker stake with a minimum of 0.1% of its total supply, deploys a new identity registry because Elysium has none, and keeps the broadcasting account as owner, guardian and dispute resolver. It refuses to run on any other chain.

SAPR_TOKEN=<$SAPR address> TREASURY_SAFE_OWNERS=<a>,<b>,<c> SAPPER_CHECKERS=<c1>,<c2>,<c3>,<c4>,<c5>,<c6> \
  forge script script/DeployElysium.s.sol --rpc-url https://rpc.elysium.kinetiq.xyz --broadcast <signer flags>

The treasury is a Safe 1.4.1 on Elysium, set by TREASURY_SAFE_OWNERS (comma-separated), TREASURY_SAFE_THRESHOLD (default 2) and TREASURY_SAFE_SALT (default 0). Its address follows from those three, so forge script script/DeploySafe.s.sol --sig "predict()" prints it before anything is sent, and script/DeploySafe.s.sol deploys it on its own. The Elysium deployment creates the Safe if it does not exist yet and refuses one whose owners or threshold differ. KEEPER defaults to the address in deployments/4663.json; CONTROL_ATTESTER, RATING_WINDOW and the operator settings work as above.

SAPPER_CHECKERS is required here and must name at least three distinct Checker addresses Sapper runs. A contract its owner has not opened to outside operators draws only those, for replays and for dispute votes, so six of them staked give every closed contract a three-Checker vote.

The deploying account owns every contract from the start, so of the steps after deployment above, all but the first apply.

Boosts, fix bonds and jobs

Each has its own script, which reads the gate and treasury from the suite's deployment file when it exists and writes its own file beside it:

Script Required Optional Writes
script/DeployBoost.s.sol SAPR_TOKEN (18 decimals) GATE, BOOST_NOTICE (7 days), BOOST_EXIT_WINDOW (3 days), BOOST_MAX_OPEN (120 days, the gate's longest path from claim to settlement at its limits, and refused below it) deployments/<name>.boost.json
script/DeployFixBond.s.sol SAPR_TOKEN (18 decimals) GATE, VERIFIER (the keeper), TREASURY, OWNER deployments/<name>.fix-bond.json
script/DeployJobs.s.sol PROVIDER, EVALUATOR, TREASURY PAYMENT_TOKEN (Elysium USDC on 99901), HOME_CHAIN_ID (99901) deployments/<name>.jobs.json

DeployJobs runs only on HOME_CHAIN_ID, which is Elysium unless set, so a deploy on a local chain sets HOME_CHAIN_ID=31337. PROVIDER must differ from TREASURY. DeployBoost and DeployFixBond take $SAPR, which has 18 decimals, and refuse a token with any other number with WrongDecimals(token, decimals, 18).

Related

  • sapper-replay: the reproduction format and replay engine Checkers run before they vote.
  • sapper-sdk: clients, the operator kit and wallet integrations that call these contracts.
  • sapperagents.com

Security

Report vulnerabilities privately through Report a vulnerability on this repository or hello@sapperagents.com. See the security policy. These contracts have not been audited.

Licence

MIT. See LICENSE. vendor/erc-8004 keeps its own licence.

About

Sapper's bounty pot, Checker network and settlement contracts. Live on Robinhood Chain, coming to Elysium.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages