Ethereum Solidity Comments


Similar to JavaScript, Solidity supports single line comments (//) and multi-line comments (/*…*/) as shown below

// This is a single-line comment.

/*
This is a
multi-line comment.
*/

Solidity contracts can also have a special form of comments for documentation. This documentation type of comments is called Ethereum Natural Specification Format (Natspec). Natspec format uses doxygen tags. It can have either one or multiple lines starting with /// or a multiline comment starting with /** and ending with */. Here is how we are using Natspec documentation in our service contract.

/// @title contract between client and contractor.
contract Service {
    address contractor; // address of the hired contractor

    /// @notice Hiring the contractor to perform the work
    /// @param _contractor Ethereum address of the contractor
    function hire (address _contractor) onlyClient {
        contractor = _contractor;
    }

    /// @notice Get the contractor assigned to the service
    /// @return contractor address
    function getContractorAddress() public constant returns (address) {
        return contractor;
    }
}

In the above code we documented the title of the contract. We also documented the two functions along with their parameters. This documentation comments are parsed by Natspec client and create documentation json files.

5 comments:

  1. I know this web page provides quality based posts and other information, is there any other web page which presents such information in quality? paypal credit login

    ReplyDelete
  2. This type of Blockchain requires write permissions to be kept centralized which makes app slower and less scalable. In addition to that, gaming cryptocurrency ICOs also require high costs and they must also be trustworthy.

    ReplyDelete
  3. You may have perused about Bitcoin for example. On the off chance that you have not delved into the subtle elements, you might get some information about the advantages of this digital currency. In the event that you have no clue about it, you should read this article. Bitcoin and Cryptocurrency

    ReplyDelete
  4. Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. jobs for python engineer

    ReplyDelete
  5. But when a company or an individual needs to hire one, the goal should be to hire experienced and reliable Mobile App Developers who can provide quality work promptly.DB Designer

    ReplyDelete

Ethereum Solidity Compiler

Ethereum contracts are written in the high level language called Solidity and compiled into bytecode using the Solidity compiler. This ...