Skip to content

assertions:assert-chainid

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

assertions:assert-chainid <expected> [message]
NameTypeDescription
expectednumberExpected chain ID
[message]stringRevert message when the assertion fails
load assertions
# Ensure the transaction only executes on Ethereum mainnet
assertions:assert-chainid 1 "wrong chain"