Bottom line: Verified source plus matching bytecode plus a recent audit is the floor. Anything less is a signature on unread code. The check takes four minutes; the drain it prevents takes seconds.

The four checks

  1. Verified source — on a block explorer, source published and compiler settings shown
  2. Bytecode match — fetched bytecode hash equals the source’s compiled hash
  3. Proxy shape — implementation address and its admin; a proxy pointing at unverified logic is unverified
  4. Permissions — who holds upgrade, pause, mint and sweep roles

Bytecode match

1
2
cast code $ADDR --rpc-url $RPC | cast keccak
forge build --contracts src/Target.sol && cast keccak $(cat out/Target.sol/Target.json | jq -r .deployedBytecode.object)

Hashes match: the deployed code is the published code. Mismatch: verified source is stale or the contract was self-destructed and redeployed.

Immutable variables embed in bytecode and will differ — compare after stripping the immutable region, or compare function selectors for a weaker signal.

Proxies

EIP-1967 implementation slot:

1
cast storage $ADDR 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc --rpc-url $RPC

Run all four checks against the implementation, not the proxy. An unverified implementation behind a verified proxy is the most common way “verified” lies.

Permissions

cast call $ADDR "owner()(address)", "admin()(address)", "paused()(bool)". Then check whether the owner is an EOA or a timelock. A single EOA with upgrade rights can change every rule after you approve.

Owner Risk
EOA high, instant changes
Multisig 3/5 medium
Timelock ≥ 48h low

Revocation as the fallback

If checks pass but time is short, grant an exact allowance, watch the first transaction, then approve(spender, 0). That bounds the blast radius to one call.

Red flags worth abandoning for

Unverified implementation, owner is a fresh EOA, transferOwnership callable by anyone, mint without cap, and bytecode that differs from source with no explanation. Each is sufficient on its own.

Operating notes

Do the four checks in order and stop at the first failure. Bytecode is the one that matters most and the one most often skipped: a verified source that does not match the deployed code is a published lie.

1
2
cast code $ADDR --rpc-url $RPC | cast keccak
forge build >/dev/null && cast keccak $(jq -r .deployedBytecode.object out/T.sol/T.json)

Match means the deployed bytecode is the published source. Mismatch on a proxy means you hashed the proxy; resolve the implementation slot and repeat.

Proxy resolution

Read slot 0x3608...2bbc, then run all four checks against that address. A verified proxy with an unverified implementation is unverified. Check upgradeTo reachability too — an implementation that anyone can swap is a different risk class.

Permission shapes

owner() is a start, not a conclusion. An owner that is a 3-of-5 multisig with a 48-hour timelock is safe enough for an exact allowance; an owner that is a fresh EOA with no timelock is not. Check paused() and whether a pause is immediate and unilateral.

Time budget

Four minutes. If it takes longer because the source is confusing, that is itself the signal — you are about to approve code you cannot read in four minutes. Use an exact amount and revoke after.

FAQ

What are the four checks to verify a contract before interacting?

The four checks are verified source, bytecode match, proxy shape, and permissions. Verified source means the source is published on a block explorer with compiler settings shown. Bytecode match confirms the fetched bytecode hash equals the source’s compiled hash. Proxy shape covers the implementation address and its admin, and permissions cover who holds upgrade, pause, mint and sweep roles.

Why does bytecode mismatch matter if the source is verified?

A verified source that does not match the deployed code is a published lie. Hashes matching means the deployed code is the published code; a mismatch means the verified source is stale or the contract was self-destructed and redeployed. Bytecode is the check that matters most and the one most often skipped.

How do I check a proxy contract correctly?

Read the EIP-1967 implementation slot, then run all four checks against the implementation, not the proxy. An unverified implementation behind a verified proxy is the most common way “verified” lies. Also check upgradeTo reachability, since an implementation anyone can swap is a different risk class.

What owner permissions should make me abandon a contract?

An owner that is a fresh EOA with no timelock is a red flag, because a single EOA with upgrade rights can change every rule after you approve. An owner that is a 3-of-5 multisig with a 48-hour timelock is safe enough for an exact allowance. Also check paused() and whether a pause is immediate and unilateral.

What should I do if I can’t finish the checks in time?

Grant an exact allowance, watch the first transaction, then call approve(spender, 0) to revoke. That bounds the blast radius to one call. If the checks take longer than four minutes because the source is confusing, that is itself the signal — you are about to approve code you cannot read.