Code Style and Conventions
Naming:
Modules: Use descriptive names like
artinals::ART20
,artinals::SALE
,artinals::TRADE
to clarify their purpose.Functions: Prefer lowercase with underscores (e.g.,
mint_art20
,initialize_deny_list
) for easy readability.Structs and Constants: Use PascalCase for structs (
NFT
,CollectionCap
) and ALL_CAPS for constants (MAX_BATCH_SIZE
).
Comments and Documentation:
Inline Comments: Place them above functions and data structures to explain their purpose and usage.
Doxygen-style Comments: Where appropriate, use brief descriptions followed by more detailed explanations. This helps when generating external documentation.
Imports and Dependencies:
Keep import statements minimal and organized at the start of each module.
Ensure that each dependency is relevant, and avoid unused imports.
Testing and Debugging:
Write thorough unit tests for each entry function.
Use debug events (
emit_debug_event
) sparingly and remove them before production.
Best Practices:
Follow the official Sui and Move documentation guidelines for code patterns.
Consistently format code to improve readability and maintainability.
Use meaningful variable and parameter names that reflect their function or resource type.
By following these language conventions, definitions, and style guidelines, you maintain a clean, understandable codebase. Combined with the concepts and tools described throughout this documentation, these appendices ensure that anyone working with the Artinals modules can do so efficiently and confidently.
Last updated