Function Visibility
Defining function visibility is mandatory. Function Types
pure and view functions do not cost any gas. Data Location
Data location must be explicitely defined for all variables. Storage is very expensive and must be used with caution. Parameter Types
Structures
Similar types should be grouped together in structures to lower gas cost. |
Array and Mappings
Arrays created in storage can have a variable size, arrays created in memory must have a fixed size at instantiation. Array can be read through by indexes, mappings cannot. Contract
Constructor
Constructors are optional, they are executed at contract creation. Functions
Interface
Definition must be identical to source function. Modifiers
Use _; to continue with the function after running modifier code. |
Events
Events are defined at contract root and emitted inside functions. Useful linksSecurity
|
Cheatography
https://cheatography.com
Solidity Cheat Sheet (DRAFT) by hsoudry
Solidity Language cheat sheet
This is a draft cheat sheet. It is a work in progress and is not finished yet.