Solidity Syntax Playground
Write, parse, and analyze Solidity smart contracts in your browser with real-time syntax highlighting and code analysis.
increment()publicnonpayabledecrement()publicnonpayablegetCount()publicview→ uint256CountChanged(uint256 newCount)countuint256publicThe state variable "count" appears to be set only once. Marking it as `immutable` saves gas by embedding the value in bytecode.
"increment" appears to only be called externally. Using `external` instead of `public` saves gas because external functions can read arguments directly from calldata.
"decrement" appears to only be called externally. Using `external` instead of `public` saves gas because external functions can read arguments directly from calldata.
"getCount" appears to only be called externally. Using `external` instead of `public` saves gas because external functions can read arguments directly from calldata.
Custom errors (introduced in Solidity 0.8.4) are cheaper than require strings and provide better error information.
Counter has 3 functions, 1 event, 1 state variable, and 5 total elements.
Solidity function selectors are the first 4 bytes of the keccak256 hash of the function signature. That's how the EVM knows which function to call!