The following establishes a coding standard for the Olympus v3/Bophades repo.
- External/public functions and variables are
lowerCamelCase
- ex. function
deposit()
- ex. variable
totalDebt
- ex. function
- Internal/private functions and variables are
_prefixed
andlowerCamelCase
- ex.
_checkApproval()
- ex.
- Contract names are
UpperCamelCase
- ex.
OlympusTreasury
- ex.
- Function arguments are
suffixed_
_issueReward(address to_)
- Module-specific functions are always
UPPERCASE
- ex.
KEYCODE()
- ex.
- Errors defined in modules must be suffixed by module's respective keycode
- ex.
TRSRY_NotApproved(...)
- Policies have no such restriction
- ex.
- Regular Comments use
//
// Regular comment hurr durr
- NatSpec comments use
///
/// @notice Natspec comment
- Contract and function groups or other major sections in SOURCE files should be denoted with
//============================================================================================//
// HEADER //
//============================================================================================//
- This is to denote sections when scrolling through large files
- All other sections should be denoted with single line header:
// ========= HEADER ========= //
- Aim for clear and succinct code
- Explicit over implicit
- Write code PRIMARILY for humans, not machines
- Comment on WHY, not WHAT. Code should be able to explain "what".
- Aim to write code that is self-documenting
- Meaning clear function names and variables
- Aim for gas-efficiency with above constraints