Smart Contracts API
Auto-generated API documentation from Solidity smart contract NatSpec comments.
Generating Documentation
To generate or update the API documentation:
cd packages/ats/contracts
npm run doc
This will:
- Extract NatSpec comments from all Solidity contracts
- Generate markdown files in this directory
- Organize documentation by contract hierarchy
Documentation Standards
All public contracts, functions, and events should include:
/**
* @title Contract name
* @notice User-facing description
* @dev Developer implementation notes
*/
contract MyContract {
/**
* @notice What this function does (user-facing)
* @dev How this function works (developer notes)
* @param _param Description of parameter
* @return Description of return value
*/
function myFunction(uint256 _param) external returns (bool) {
// ...
}
}
Finding Documentation
Navigate the API documentation by:
- By Feature: Look for domain-specific facets (Bond, Equity, etc.)
- By Layer: Explore contracts by their architectural layer (0-3)
- By Interface: Find interface definitions in the interfaces section
- Search: Use the search functionality to find specific contracts or functions
Documentation Structure
The generated API documentation is organized by contract hierarchy:
- Layer 0: Storage Wrappers (ERC1400StorageWrapper, KycStorageWrapper, etc.)
- Layer 1: Core Implementation (ERC1400Implementation, AccessControl, etc.)
- Layer 2: Domain Features (BondFacet, EquityFacet, etc.)
- Layer 3: Jurisdiction-Specific (USA implementations)
- Infrastructure: ProxyAdmin, BusinessLogicResolver, Factory
Contributing Documentation
When adding new contracts or modifying existing ones:
- Write comprehensive NatSpec comments
- Generate documentation:
npm run doc - Review the generated output
- Commit both code and documentation changes
For detailed guidelines on writing contract documentation, see the Documenting Contracts Guide.
Related Guides
- Contract Overview - Understand contract architecture
- Documenting Contracts - Write better documentation
- Adding Facets - Create new facets
Note: This documentation is auto-generated from the latest source code. If you find errors or missing documentation, please check the source contracts and update the NatSpec comments accordingly.