Docs/Examples/Supply Governance

SupplyGovernanceModule (Timelock Supply Queue)

Enforces a timelock queue for item supply changes — no participant can control execution timing when supply changes affect all asset holders.


Overview

SupplyGovernanceModule manages a registry of named item types and enforces a timelock queue for supply changes. Supply increases or decreases are queued with a mandatory delay and executed autonomously at the committed time. Every change is recorded in an on-chain audit log.

PropertyValue
Base contractAutoLoopCompatible (no VRF)
VRF usageNone
Gas per tick~60k–120k
Sourceautoloop/src/agents/SupplyGovernanceModule.sol
Tests37 passing (unit + fuzz)

Why AutoLoop Is Structurally Required

Supply changes affect all asset holders. Whoever controls execution timing can front-run the change:

  • Before a supply increase: short the asset, then execute to drive price down
  • Before a supply decrease: buy the asset, then execute to drive price up

The timelock prevents immediate surprise changes. AutoLoop enforces that execution happens at executeAfter — not earlier, and not delayed by the operator's discretion. Combined, they remove the timing attack surface entirely.

The pattern matches how Diablo's RMAH was shut down without warning, or how Valve can re-release "limited" TF2 hats — in both cases there was no on-chain commitment and no neutral executor.

Mechanics

  • createItemType(name, maxSupply): registers a new item type with an immutable supply cap. Admin only.
  • queueSupplyChange(itemTypeId, delta, reason, delay): queues a supply delta with a mandatory timelock delay. Admin only. Positive delta = mint, negative = burn.
  • cancelChange(changeIdx): cancels a pending change before execution. Admin only.
  • freezeItem(itemTypeId): permanently prevents further supply changes to an item. Admin only.
  • progressLoop(): finds the first change whose executeAfter has passed and executes it, capped by maxSupply. Records to audit log.

Revenue Model

  • AutoLoop gas fee on each tick
  • No protocol fee (pure governance primitive)

Deploy

forge create src/agents/SupplyGovernanceModule.sol:SupplyGovernanceModule \
  --constructor-args 3600 \
  --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Args: checkInterval (seconds between readiness checks). 1 hour is typical; the actual execution time is determined per-change by the delay parameter.

Dashboard

View SupplyGovernanceModule on the AutoLoop Dashboard.