contract MyContract {
  /// @dev Total number of coins
  public uint256 totalSupply;

Solc automatically creates a totaSupply() function, however the natspec comment doesn't come through. How can I do that?

1 Answer 1


According to the official documentation:

NatSpec currently does NOT apply to public state variables (see solidity#3418), even if they are declared public and therefore do affect the ABI.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.