ParameterAlerter (On-chain Audit Trail)
Snapshots tracked game-parameter values on every tick and emits an immutable audit record on any drift — tamper-proof proof against stealth nerfs.
Overview
ParameterAlerter tracks a set of named game parameters and creates an immutable audit trail of every change. On each AutoLoop tick, it snapshots all tracked values and emits ParameterChanged events for any that have drifted since the last snapshot. The audit log is permanently on-chain and verifiable by any observer.
| Property | Value |
|---|---|
| Base contract | AutoLoopCompatible (no VRF) |
| VRF usage | None |
| Gas per tick | ~30k–80k (scales with tracked params and change count) |
| Source | autoloop/src/agents/ParameterAlerter.sol |
| Tests | 28 passing (unit + fuzz) |
Why AutoLoop Is Structurally Required
Stealth nerfs require no neutral snapshotter. Any human trigger can be delayed until after the operator has front-run the parameter change. For example:
- Operator decides to reduce drop rate from 10% to 3%
- Operator sells all items with the old drop rate
- Operator calls
setParam("dropRate", 300)to update the contract - Only then triggers the snapshot — which records the change "faithfully" but after the fact
AutoLoop's autonomous tick fires at the next interval regardless. The snapshot is taken before any human can act on it, and the audit trail begins at the committed time — not at the operator's convenience.
Mechanics
- addTrackedParam(key, initialValue): registers a new parameter key with its starting value. Admin only.
- setParam(key, value): updates a parameter's current value. Admin only (simulates operator changing a game setting).
- progressLoop(): on each tick, compares
currentParams[key]tolastSnapshotted[key]for every tracked key. Any difference emitsParameterChangedand pushes aChangeRecordto the on-chain audit log. - getAuditLog(index): returns the full
ChangeRecordstruct — key, old value, new value, block number, timestamp.
Revenue Model
- AutoLoop gas fee on each tick
- No protocol fee (pure audit primitive)
Deploy
forge create src/agents/ParameterAlerter.sol:ParameterAlerter \
--constructor-args 3600 \
--rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcastArgs: checkInterval (seconds between snapshots). A 1-hour interval (3600) is typical for game parameters.
After deploy, register with AutoLoop and call addTrackedParam for each parameter you want to audit.
Dashboard
View ParameterAlerter on the AutoLoop Dashboard.