Using surya describe

The surya describe <files..> command is used to generate a report in text format, which describes the functions present in the contract. It lists all of the functions present in the contract supplied as the argument. The command does not list the functions of inherited contracts.

The command takes the Solidity contract file path as an argument. The following screenshot shows the output of the surya describe command executed for the Crowdsale.sol contract:

$ surya describe contracts/crowdsale/Crowdsale.sol

 The surya describe command result for the Crowdsale.sol contract

Let-us understand the symbols and meaning of this output:

  • The generated output lists the visibility of the function as follows:
  • [Pub]: This is highlighted in green and the function is a public function
  • [Ext]: This is highlighted in blue and the function is an external function
  • [Int]: This is highlighted in gray and the function is an internal function
  • Some symbols are also used:
  • # (hash): The symbol is highlighted in red, indicating that the function can change the contract state variable
  • ($) (dollar sign): The symbol is highlighted in yellow color, that the function is payable functions and can receive ether as well along with the transaction

Having the preceding report generated we can quickly identify that functions that are changing the contract's state variables and payable functions must be checked rigorously to ensure that there are no bugs in them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.1.156