Skip to content

Oracle epoch-fee utility (tokenomics §4)#16

Merged
RunTimeAdmin merged 3 commits into
masterfrom
feat/epoch-fee-utility
Jul 13, 2026
Merged

Oracle epoch-fee utility (tokenomics §4)#16
RunTimeAdmin merged 3 commits into
masterfrom
feat/epoch-fee-utility

Conversation

@RunTimeAdmin

Copy link
Copy Markdown
Owner

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)

  • Operators/querying apps prepay $CSIG toward an agent's epoch coverage (depositFor, anyone can fund).
  • Oracle charges one epochFee per agent it scores (chargeEpoch, ORACLE_ROLE, returns false when uncovered — no revert).
  • isCovered view for the oracle; the free meetsThreshold read stays free — the fee gates the write.
  • Three-stage routing (§6): distributeFees sweeps collected — Bootstrap 100%/0, Transition 80/20, Mature 50/50 (burn to 0xdead).
  • Operator-only withdraw of unspent; governance-tunable epochFee/stage/rewardPool. epochFee=0 disables gating.
  • 19 tests incl. storage-slot pin.

Oracle integration — fully opt-in

Active only when FEE_REGISTRY_ADDRESS is set and on-chain epochFee > 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; epochFee defaults to 0 so deploying it is non-disruptive). .env.example documents the flag.

Full suite 132 pass, oracle 55, deploy dry-run clean, slither clean on the contract.

🤖 Generated with Claude Code

dev-mondoshawan and others added 3 commits July 12, 2026 21:48
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>
@RunTimeAdmin RunTimeAdmin merged commit bde2e9d into master Jul 13, 2026
3 checks passed
@RunTimeAdmin RunTimeAdmin deleted the feat/epoch-fee-utility branch July 13, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants