3

In some contracts I saw comments that are made with "/*" and "/**". For me the only change would be in the IDE like Remix, that the color changes from green (/*) to blue (/**). I until now liked the "/**" more but now got an error and do not understand what the "/**" does. Following code:

/**
 * @event Transfers token
 */
event Transfer(address indexed from, address indexed to, uint256 value);

Gives me

DocstringParsingError: Doc tag @event not valid for functions.



but replacing "@event" with "@dev"

/**
 * @dev Transfers token
 */
event Transfer(address indexed from, address indexed to, uint256 value);

Works

and using @event above almost anything else

/**
 * @event Transfers token
 */
public uint anynumber;

Also works.

So as I understand, in "/**" is more than just commenting. What is that and why does "@event" not work above an Event even it is just a comment?

4

It is the Ethereum Natural Specification Format.

Documentation is inserted above the function following the doxygen notation of either one or multiple lines starting with /// or a multiline comment starting with /** and ending with */.

In the specification @dev is an existing tag, and @event is not defined.

| improve this answer | |
  • Oh great, thanks! Did not think that it has more functions than just comments. Sad I can't make comments in blue anymore without having more functions than wanted :D. – dkb Mar 11 '18 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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