fmt.sol 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. pragma solidity ^0.8.13;
  2. /// @title A Hello world example
  3. contract HelloWorld {
  4. /// Some example struct
  5. struct Person {
  6. uint256 age;
  7. address wallet;
  8. }
  9. /**
  10. * Here's a more double asterix comment
  11. */
  12. Person public theDude;
  13. /// Constructs the dude
  14. /// @param age The dude's age
  15. constructor(uint256 age) {
  16. theDude = Person({age: age, wallet: msg.sender});
  17. }
  18. /**
  19. * @dev does nothing
  20. */
  21. function example() public {
  22. /**
  23. * Does this add a whitespace error?
  24. *
  25. * Let's find out.
  26. */
  27. }
  28. /**
  29. * @dev Calculates a rectangle's surface and perimeter.
  30. * @param w Width of the rectangle.
  31. * @param h Height of the rectangle.
  32. * @return s The calculated surface.
  33. * @return p The calculated perimeter.
  34. */
  35. function rectangle(uint256 w, uint256 h)
  36. public
  37. pure
  38. returns (uint256 s, uint256 p)
  39. {
  40. s = w * h;
  41. p = 2 * (w + h);
  42. }
  43. /// A long doc line comment that will be wrapped
  44. function docLineOverflow() external {}
  45. function docLinePostfixOverflow() external {}
  46. /// A long doc line comment that will be wrapped
  47. /**
  48. * @notice Here is my comment
  49. * - item 1
  50. * - item 2
  51. * Some equations:
  52. * y = mx + b
  53. */
  54. function anotherExample() external {}
  55. /**
  56. * contract A {
  57. * function foo() public {
  58. * // does nothing.
  59. * }
  60. * }
  61. */
  62. function multilineIndent() external {}
  63. /**
  64. * contract A {
  65. * function foo() public {
  66. * // does nothing.
  67. * }
  68. * }
  69. */
  70. function multilineMalformedIndent() external {}
  71. /**
  72. * contract A {
  73. * function withALongNameThatWillCauseCommentWrap() public {
  74. * // does nothing.
  75. * }
  76. * }
  77. */
  78. function malformedIndentOverflow() external {}
  79. }
  80. /**
  81. * contract A {
  82. * function foo() public {
  83. * // does nothing.
  84. * }
  85. * }
  86. */
  87. function freeFloatingMultilineIndent() {}