Smart contract guide

How to get notified when a contract changes owner or is paused

The changes that matter most on a contract are rare: ownership handed to a new address, the contract paused, a proxy pointed at new code, an admin role granted. When one happens on a contract that holds your funds or that your product depends on, you want to know straight away, not when someone posts about it. This guide sets up an alert for each of those changes, shows which ones need a pasted event signature, and explains what an alert can and can't catch.

Just want the alert? See smart contract event alerts

6 min read

Which admin changes a contract announces

Most contracts build their admin controls from the same standard pieces, and each piece writes an event log when it is used. An event rule matches that log, so it fires whichever way the change was made: by the owner's wallet, a Safe, a timelock or another contract.

  • Ownership: OwnershipTransferred(address indexed previousOwner, address indexed newOwner). Two-step ownership also logs OwnershipTransferStarted when the transfer is proposed.
  • Pausing: Paused(address account) and Unpaused(address account).
  • Upgrades of a proxy: Upgraded(address indexed implementation) when it points at new code, and AdminChanged(address previousAdmin, address newAdmin) when its admin changes.
  • Roles: RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) and RoleRevoked, with the same parameters.
  • OwnershipTransferred, Upgraded and AdminChanged are in the standard event catalog, picked by name. For Paused, Unpaused and the role events, paste the signature as written above, or copy it from the contract's Etherscan page.
Example alert
ContractExample

Ownership moved from 0x3f5c…e0b7 to 0x9f2c…9a71

Contract 0x87b1…4e2a · Rule: Everything on the contract

Ethereum · View on Etherscan09:41

Set up an event rule for each change

Open the Everything on a contract template and paste the contract's address. For an upgradeable contract, that is the proxy address, which is where the events are emitted. The template starts with one rule on every event; open it and pick OwnershipTransferred from the catalog instead, so the rule names the event and its arguments.

Add one rule per change you care about: one for ownership, one for Paused, one for Unpaused, one for RoleGranted. Each rule has its own name, shown on every alert it sends, so you can tell at a glance which change it was.

Conditions narrow a rule by argument name. For example, on RoleGranted, account is not one of your team's addresses alerts only when a role goes to someone new.

Proxy upgrades with one template

For an upgradeable contract, the Contract upgraded template sets the rules for you: Upgraded and AdminChanged, plus OwnershipTransferred when the contract is a listed one that emits it. Pick a well-known contract from the address field, or paste any proxy address.

An upgrade replaces every line of a contract's logic at once, so it is the one admin change worth an alert on every contract that holds your funds.

Contracts you operate: Admin method called

On a contract you run yourself, you can also watch the admin functions directly. The Admin method called template starts with a rule on any successful call; open it and pick the method from the contract's ABI, or paste its signature, such as pause() or transferOwnership(address newOwner).

A method rule can also keep failed calls, which shows someone trying an admin function they aren't allowed to use, and the Caller outside an allow-list template alerts when any address other than your team's calls the contract at all.

Source

Contract

0x87b1…4e2a

Rule

Admin method called

pause()

Telegram alert
ContractExample

0x3f5c…e0b7 paused the contract

Contract 0x87b1…4e2a · Rule: Admin method called

Ethereum · View on Etherscan09:41

What an event rule can't see

An event rule only knows what the contract logs. A contract that changes an owner, a fee or a limit without emitting an event can't be caught by an event rule, however the change is made. Check the contract's source or its Events tab on Etherscan before you rely on an event.

For a change with no event, a method rule on the function that makes it is the fallback, with one limit: method rules see direct calls only, where the transaction is sent to the contract itself. Calls routed through Safes, routers, multicall or smart accounts are coming with Premium, and a call made by a timelock or any other contract isn't a direct call either. A contract owned by a Safe is the common case, so pair the event rules with a Safe multisig alert on the owner.

Limits to know

Before you rely on these alerts, these are the edges today:

  • Alerts arrive after the transaction is confirmed. They can't stop, delay or reverse a change; they give you time to react.
  • Alerts arrive within seconds of the transaction being confirmed. Pending (mempool) transactions are not alerted.
  • An event is one transaction seen on one watched address. It counts once, whether it matches none, one or several of your rules and however many channels it fans out to. An alert is sent only when a rule matches. Admin events are rare, but the transactions around them are not: a rule on a busy token's contract counts every transaction on it.
  • Alerts on Chain is read-only. It watches public addresses and never asks for a private key or a seed phrase.
  • Ethereum mainnet only. More networks are planned, but none is live yet.
  • Telegram is the only live channel. Discord, Slack, email and webhooks are coming.

Set it up step by step

From sign-in to your first alert, in the actual dashboard.

  1. 1
    Sign in at alertsonchain.com with Google or with your wallet. A wallet sign-in is a signed message, not a transaction, so it costs no gas.
  2. 2
    Open the Channels tab and connect Telegram: start a chat with @alertsonchain_com_bot, send /start, and paste the 8-character code it replies with.
  3. 3
    Open the Everything on a contract template, or Contract upgraded for a proxy, and paste the contract's address. Use the proxy address for upgradeable contracts.
  4. 4
    Open the rule and pick OwnershipTransferred from the catalog. Add one rule per change, pasting the signature for Paused, Unpaused, RoleGranted or RoleRevoked.
  5. 5
    For a contract you operate, add the Admin method called template and pick the admin methods. Pick the Telegram chat each rule sends to, such as your team's group.
  6. Click Create rule. The rule is active straight away, and the next matching transaction sends a Telegram message.

Frequently asked questions

  • Can I hear about an upgrade before it happens?

    Not from the upgrade itself: pending transactions are not alerted. If the contract's owner is a timelock, the timelock logs an event when the upgrade is scheduled, such as CallScheduled on an OpenZeppelin TimelockController. Paste that signature in an event rule on the timelock to hear about it during the delay.

  • How do I find out which events a contract emits?

    For a listed contract, the event picker shows its events under "Events of this contract". For any other contract, open its Etherscan page: the verified source and the Events tab show what it logs, with the parameter names to paste.

  • The contract is owned by a Safe. Will I still get alerts?

    Yes, from event rules: OwnershipTransferred, Paused and the others are logged whichever address made the change. A method rule wouldn't see it, because the call comes from the Safe and not from a wallet. Add a Safe multisig alert on the owner to see each transaction the Safe executes.

  • Can an alert pause my contract when something looks wrong?

    No. Alerts on Chain is read-only. It watches public addresses and never asks for a private key or a seed phrase. An alert tells you what happened; any response is yours to send.