> For the complete documentation index, see [llms.txt](https://zokyo-auditing-tutorials.gitbook.io/zokyo-informational-vulnerabilities/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zokyo-auditing-tutorials.gitbook.io/zokyo-informational-vulnerabilities/tutorials/informational-vulnerability-10-naming-convention.md).

# Informational Vulnerability 10: Naming Convention

{% hint style="info" %}
[**Book an audit with Zokyo**](https://www.zokyo.io/)
{% endhint %}

**Introduction:** Naming conventions are a cornerstone of effective software development, fostering readability, consistency, and a unified coding style. Solidity, as a prominent language for writing Ethereum smart contracts, is no exception. Adopting established naming conventions in Solidity is essential for producing clean, maintainable, and standardized codebases. This tutorial aims to guide developers through the prevalent naming conventions in Solidity, promoting best practices for crafting clear and comprehensible smart contracts.

#### **1. Contract and Library Names**

* **PascalCase:** Contract and library names should be written in PascalCase, meaning that each word is capitalized without spaces or punctuation.

  ```solidity
  solidityCopy codecontract AssetManager {...}
  ```

#### **2. Function Names**

* **camelCase:** Function names should adopt the camelCase format, starting with a lowercase letter followed by uppercase initials for subsequent words.

  ```solidity
  solidityCopy codefunction getTotalAssets() public view returns (uint256) {...}
  ```

#### **3. Event Names**

* **PascalCase:** Similar to contracts, event names should also be in PascalCase to ensure they are easily distinguishable and readable.

  ```solidity
  solidityCopy codeevent AssetAdded(address indexed assetOwner, uint256 assetValue);
  ```

#### **4. Modifier Names**

* **camelCase:** Modifiers should follow the same convention as function names, utilizing camelCase for consistency.

  ```solidity
  solidityCopy codemodifier onlyOwner() {...}
  ```

#### **5. Variable Names**

* **camelCase:** Variables, including state variables and local variables, should be named using camelCase to maintain uniformity across the code.

  ```solidity
  solidityCopy codeuint256 totalSupply;
  ```

#### **6. Constants and Enum Types**

* **UPPER\_CASE\_WITH\_UNDERSCORES:** Constants and enum types should be named using uppercase letters, separated by underscores to denote spaces.

  ```solidity
  solidityCopy codeuint256 constant MAX_SUPPLY = 10000;
  enum AssetState { ACTIVE, INACTIVE, PENDING }
  ```

#### **7. Struct Names**

* **PascalCase:** Structs should adopt PascalCase to maintain a clear and distinguished naming style.

  ```solidity
  solidityCopy codestruct AssetInfo {...}
  ```

#### **Conclusion and Best Practices**

Adherence to a coherent naming convention is instrumental in enhancing code readability and maintainability. It fosters a professional coding environment, facilitating collaboration and communication among developers.

* **Consistency:** Ensure that naming conventions are consistently applied throughout the codebase.
* **Clarity:** Choose names that convey the purpose or functionality of the contracts, functions, or variables clearly and concisely.
* **Documentation:** Complement the naming conventions with adequate documentation to further elucidate the code's purpose and functionality.

Embarking on your Solidity development journey with these conventions as your guide will ensure a well-organized, professional, and highly maintainable codebase, setting a solid foundation for successful and secure smart contract deployment and execution.
