Skip to content

assert-chainid

Assert the chain ID equals an expected value, on-chain.

assert-chainid <expected> [message]
Name Type Description
expected number Expected chain ID
[message] string Revert message when the assertion fails
load assertions
# Ensure the transaction only executes on Ethereum mainnet
assertions:assert-chainid 1 "wrong chain"