Oracle epoch-fee utility (tokenomics §4)#16
Merged
Conversation
Implements tokenomics §4 "Oracle Epoch Prioritization" + §6 three-stage fee routing. Operators/querying apps prepay $CSIG toward an agent's epoch coverage; the oracle charges one epochFee per agent it scores, and uncovered agents fall out of the active run (the free meetsThreshold read is unaffected). UUPS, matching the repo convention. Charged fees accumulate in `collected` and distributeFees() sweeps them per stage (Bootstrap 100%/0, Transition 80/20, Mature 50/50). epochFee=0 disables gating (testnet default). Anyone may fund an agent; only the operator withdraws unspent balance. 19 tests incl. storage-slot pin for upgrade safety. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When FEE_REGISTRY_ADDRESS is set and the on-chain epochFee > 0, the epoch loop checks coverage (concurrently in the read phase), skips uncovered agents, and charges one fee after a successful score proposal. Fully opt-in: with no registry configured the oracle scores every agent exactly as before, so the live testnet oracle is unaffected. chain.js gains feeGatingConfigured/getEpochFee/isCovered/ chargeEpoch (DI-injectable). 2 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
DeployEpochFees.s.sol deploys the registry behind a UUPS proxy, grants ORACLE_ROLE to the oracle wallet, and asserts wiring post-deploy. epochFee defaults to 0 so deploying it does not disrupt the running oracle until governance sets a fee. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds the "Oracle Epoch Prioritization" utility (tokenomics §4) — the $CSIG use that gates inclusion in the scoring epoch, and the first protocol revenue mechanism. This is the missing half of the Howey anchor: it makes "$CSIG is a tool you must pay with to use the network" true on-chain.
Contract —
CountersigEpochFees(UUPS)depositFor, anyone can fund).epochFeeper agent it scores (chargeEpoch, ORACLE_ROLE, returns false when uncovered — no revert).isCoveredview for the oracle; the freemeetsThresholdread stays free — the fee gates the write.distributeFeessweepscollected— Bootstrap 100%/0, Transition 80/20, Mature 50/50 (burn to 0xdead).withdrawof unspent; governance-tunableepochFee/stage/rewardPool.epochFee=0disables gating.Oracle integration — fully opt-in
Active only when
FEE_REGISTRY_ADDRESSis set and on-chainepochFee > 0: the epoch loop checks coverage concurrently, skips uncovered agents, charges after a successful proposal. With no registry configured (testnet default) the oracle scores everyone exactly as before — the live oracle is untouched. 2 tests.Deploy
DeployEpochFees.s.sol(UUPS proxy, grants ORACLE_ROLE, asserts wiring;epochFeedefaults to 0 so deploying it is non-disruptive)..env.exampledocuments the flag.Full suite 132 pass, oracle 55, deploy dry-run clean, slither clean on the contract.
🤖 Generated with Claude Code