assert-chainid
Assert the chain ID equals an expected value, on-chain.
Syntax
Section titled “Syntax”assert-chainid <expected> [message]Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
expected |
number |
Expected chain ID |
[message] |
string |
Revert message when the assertion fails |
Examples
Section titled “Examples”load assertions
# Ensure the transaction only executes on Ethereum mainnetassertions:assert-chainid 1 "wrong chain"