Skip to content

assert-codehash

Assert an address has a specific code hash, on-chain.

assert-codehash <target> <expected> [message]
Name Type Description
target address Address to check
expected bytes32 Expected code hash (keccak256 of the runtime bytecode)
[message] string Revert message when the assertion fails
load assertions
# Pin an implementation by its runtime code hash
assertions:assert-codehash 0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb @codehash(0xf8D1677c8a0c961938bf2f9aDc3F3CFDA759A9d9) "implementation changed"