We manage your security to weather the AI storm →

← Resource Hub

Smart Contract Monitoring: 40 Detectors for DeFi Teams

By Daniel GelfandPublished 11 min read

Smart Contract Monitoring: 40 Detectors for DeFi Teams

Quick answer. Monitor every privileged change, from owners and roles to upgrades, multisig and timelock settings, plus oracle health, outflows, solvency, governance queues and offchain systems like DNS, frontends and keepers. Reconcile events against live state, and route each alert by severity to a named responder.

Watch: Smart Contract Monitoring: 40 Detectors for DeFi Teams 1:42
Video transcript

What should a DeFi protocol monitor after launch? Every privileged change, oracle health, outflows, governance queues and offchain systems, each routed by severity to a named responder.

Our checklist has forty detectors in three tiers. P zero means funds or control are at risk now. P one needs a person within minutes, P two a same-day ticket.

Start with powers that move funds or replace code: ownership, roles, proxy upgrades, and Safe owners and thresholds. Read proxy slots every block, so a silent change still fires.

For oracles, Chainlink lists circuit breakers, kill switches and alerts on feed deviations. Set each staleness threshold from the feed's own heartbeat, not a global default.

Events alone can mislead. Guardian's public reports show a liquidation event logging zero collateral, events that could never fire, and paths with no event. So reconcile balances against live state.

A timelock only warns if someone reads the queue, so decode every scheduled call. Offchain, watch DNS, frontend scripts and keeper heartbeats. A drain does not need a contract bug.

Give every detector a written spec: a baseline, a tuned threshold, a named owner, a paging channel with a backup, and a runbook. Test pause paths on a fork.

Read the full checklist to copy all forty detectors. Guardian's Managed Security monitors contracts every block, Sentry watches domains, DNS and cloud, and engineers handle response.

Why a Detector List

This is a copyable detector list for a live DeFi protocol: 40 checks, each with a fire condition and a tier.

Our onchain monitoring guide explains what monitoring is and how to build or buy it.

P0 means funds or control are at risk now. P1 needs a person within minutes, P2 a same-day ticket.

Admin, Role and Upgrade Events

These detectors watch powers that move funds or replace code. Most fire on a standard event, then confirm with a state read.

OpenZeppelin documents OwnershipTransferred, RoleGranted, RoleRevoked and RoleAdminChanged for its access contracts. Its default-admin rules add events for scheduled admin transfers and delay changes. OpenZeppelin

ERC-1967 proxies emit Upgraded, BeaconUpgraded and AdminChanged, and keep the implementation, beacon and admin addresses in fixed storage slots. Ethereum EIPs

Read those slots every block, so a change without an event still fires detector 6.

Safe owners, thresholds, modules and guards decide who can act through a multisig. Safe emits events when owners or the threshold change. Safe

Safe multisig monitoring covers delegatecalls, the queue and the nonce.

Guardian's Glider review documented a zero-second default-admin delay (Info, I-03, pending). That leaves little review time, so detector 4 should read the pending admin and delay directly. Guardian

No.DetectorFire whenTier
1Ownership transferOwnershipTransferred or OwnershipTransferStarted outside an approved changeP0
2Role grant or revokeRoleGranted or RoleRevoked on any privileged roleP0
3Role admin changeRoleAdminChanged on any roleP0
4Default admin transferAdmin transfer or delay change scheduled, or admin renouncedP0
5Proxy upgradeUpgraded, BeaconUpgraded or AdminChanged emittedP0
6Slot driftImplementation, beacon or admin slot differs from baselineP0
7Safe owner changeOwner added, removed or swappedP0
8Safe threshold dropThreshold lowered, or below policy for the owner countP0
9Safe module or guardAny module enabled or guard changedP0
10Pause changePaused or unpaused outside a scheduled drillP0
11Mint or cap breachSupply or mint rate exceeds its set capP0
12Unexpected callerSuccessful privileged call from an address off the allowlistP0

Oracle and Price Signals

Chainlink lists safeguards its users run: circuit breakers, waiting for a fresh input, a manual kill switch and alerts on feed deviations. Chainlink

For single-source feeds, it says to detect stale, delayed, missing or unexpected values and compare against independent references.

Set each staleness threshold from the feed's own heartbeat, not a global default. Compare against a second source an attacker cannot move in one block.

Chainlink's L2 sequencer uptime feeds flag downtime and support a grace period before liquidations resume. Chainlink is no longer expanding them to new networks, though existing feeds stay supported. Chainlink Documentation

No.DetectorFire whenTier
13Oracle source changeFeed, adapter or aggregator address changesP0
14Stale priceLast update older than the feed's heartbeat plus marginP0
15Price deviationGap to an independent reference exceeds its bound, or moves fastP0
16Invalid answerZero, negative, out of bounds or wrongly scaledP1
17Sequencer downL2 sequencer reported down, or restarted within a grace periodP1

Liquidity and Outflow Anomalies

Outflow detectors need a baseline per contract: normal daily volume, withdrawal size and holder mix. Without one, thresholds are guesses.

Events alone can mislead here. Guardian's public reports show three ways.

In RAAC's core contracts, a liquidation event reported zero ERC-20 collateral after the collateral was transferred (Low, L-08, resolved). No direct fund loss was shown, but an event-driven monitor would log the wrong amount. Guardian

In Ethereal's protocol review, PnL-mismatch events could never fire, because the tolerance sat below the emission threshold (Low, L-05, resolved). Drift monitoring built on them stays silent.

In GMX's incentives contracts, some state-changing paths emitted no protocol event (Info, I-01, acknowledged). Only state reads or token-transfer reconciliation would see them.

Detector 21 reconciles token balances against internal accounting every block. It catches what events misreport or skip.

No.DetectorFire whenTier
18Treasury outflowTreasury or vault transfer above a set size or rateP0
19Abnormal withdrawalsWithdrawals far above baseline per block or hourP1
20TVL dropTVL falls past a set percentage within a windowP1
21Balance reconciliationToken balances diverge from reserves, liabilities or internal accountingP1
22Utilization near capUtilization or a borrow cap passes a warning levelP2
23Health factorsLarge positions approach their liquidation thresholdP1
24Liquidation spikeLiquidation count or size far above baselineP1
25Bad debtDebt exceeds collateral value on any position or marketP1
26ConcentrationOne address holds outsized supply, debt or liquidityP2
27Flash loan volumeFlash-loan-funded calls into your contracts above baselineP2
28Bridge mismatchMessage, nonce or minted amount differs from the source chainP1

Governance and Timelock Events

A timelock only warns if someone reads the queue. Decode each scheduled call and post its target, function and countdown.

OpenZeppelin's TimelockController emits CallScheduled, CallExecuted, Cancelled and MinDelayChange. AccessManager uses OperationScheduled, OperationExecuted, OperationCanceled and TargetAdminDelayUpdated. OpenZeppelin

In TimelockController, a delay change must itself be scheduled and executed, so detector 30 sees it first.

Read proposals that grant roles or swap oracles before the votes land.

No.DetectorFire whenTier
29Delay reducedTimelock or admin delay loweredP0
30Call scheduledOperation queued; alert with decoded calldataP1
31Call executedAny CallExecuted whose id was never decoded and approved, or run by an unexpected executorP1
32Call cancelledOperation cancelled; record who and whyP1
33Proposal createdNew proposal touching roles, upgrades, oracles or treasuryP1
34Votes and quorumSudden voting power, delegation swing or unusually early quorumP1
35Queue anomalyExecution without a passed proposal, or out of orderP1

Offchain Signals: DNS, Frontend, Keepers

A drain does not need a contract bug. A hijacked domain or tampered script can ask users to sign for an attacker.

Keepers and relayers fail quietly. A missed liquidation run first shows as a heartbeat gap.

Our DeFi DNS hijack prevention checklist covers registrar locks, certificate alerts and the first hour of a hijack.

No.DetectorFire whenTier
36Keeper or relayer heartbeatExpected job or message missing past its intervalP1
37Monitor lag or reorgMonitor, RPC or indexer behind head, or reorg past confirmation depthP1
38DNS and TLSNameserver, registrar, lock, record or unexpected certificate changeP1
39Frontend integrityBundle hash, CSP, third-party script or dependency changesP1
40CI/CD and cloudBranch protection, deploy artifact, IAM, KMS or secret store changesP2

Prioritizing and Routing Alerts

Route by consequence, not by data source. The table sets each tier's first move.

Give every detector a written spec with the seven fields below before it goes live.

Record baselines independently of the monitor. Test pause and escalation paths on a fork after every upgrade or signer change.

OpenZeppelin Monitor, an open-source option, matches contract functions, events and transactions with expressions, schedules and notifications. OpenZeppelin

A P0 alert helps only if the pause works. Our DeFi incident response plan guide covers pause authority, signers and drills.

  • Baseline: the recorded state or normal range to compare against.
  • Threshold: the value that fires it, tuned on past data.
  • Owner and tier: a named person, and P0, P1 or P2.
  • Channel: where it pages, plus a backup on a different vendor.
  • Suppression: approved changes and maintenance windows, with the approver logged.
  • Evidence: transactions, blocks and decoded calldata, kept for review.
  • Runbook: the first three actions, and who may take them.
TierDetectorsFirst moveWho acts
P017Pre-authorized pause or containment, then pageOn-call engineer and signers
P119Page a person around the clockOn-call engineer
P24Open a ticket and investigate the same dayOwning team

Frequently Asked Questions

Does ADGM's draft DeFi guidance require protocols to run these detectors?

No. ADGM FSRA Consultation Paper No. 5 of 2026 is a proposal for Authorised Persons and Recognised Bodies engaging with DeFi, not for protocols. Comments close on 30 November 2026, and the text may change after that. ADGM FSRA

Is OpenZeppelin Monitor enough to run this list?

It covers event and function detectors. Its docs call main-branch pages unreleased and point production users to v1.3.x, so check features and chains against your version. They describe matching functions, events and transactions, not reading storage, so slot drift and balance reconciliation need a separate reader. OpenZeppelin

Do immutable contracts need these detectors?

Fewer of them. Proxy upgrade detectors may not apply, but oracle, outflow, solvency, keeper and offchain detectors still do, because prices, users, dependencies and frontends keep changing after deployment.

Sources

Need These Detectors Watched Around the Clock?

Guardian's Managed Security monitors contracts every block for privileged calls, upgrades, multisig transactions and large fund movements. Sentry watches domains, DNS and cloud, and engineers handle response.