Skip to content

Commit

Permalink
chore: add note in README
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Aug 1, 2023
1 parent 20421b4 commit d6c3f49
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Once you're satisfied, simply refer to your template using the `templatePath` pa

Feel free to open an issue if you need help or if you encounter a problem! Here are some already known problems though:

- If you're defining Errors in Libraries, please do that in the scope of the contract.
- Due to the technical limitations of the Solidity compiler, the documentation of `private` functions is not rendered.
- Functions that are not commented at all might not be rendered.
- State variables overriding functions defined by an interface might "erase" the name of the parameters. A current workaround is to name the function parameters using the `_0`, `_1`, ... format.
7 changes: 6 additions & 1 deletion examples/contracts/SomeOtherLibrary/SomeOtherLibrary.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.8.6;

contract SomeOtherLibrary {
library SomeOtherLibrary {
/// @notice Invalid hash.
/// @dev Reverts when hash has already been discovered.
/// @param invalidHash Invalid hash.
error SomeError(bytes32 invalidHash);

/// @dev This function uses `keccak256(..)` to hash text.
/// @notice Hash returned.
/// @param someText Any text that you want to hash.
Expand Down
14 changes: 13 additions & 1 deletion examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{
"methods": {},
"events": {},
"errors": {},
"errors": {
"SomeError": {
"code": "error SomeError(bytes32 invalidHash)",
"inputs": {
"invalidHash": {
"type": "bytes32",
"description": "Invalid hash. "
}
},
"notice": "Invalid hash.",
"details": "Reverts when hash has already been discovered."
}
},
"internalMethods": {
"someFunction(string)": {
"code": "function someFunction(string someText) internal pure returns (bytes32)",
Expand Down
21 changes: 21 additions & 0 deletions examples/docs/contracts/SomeOtherLibrary/SomeOtherLibrary.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,24 @@ Hash returned.



## Errors

### SomeError

```solidity
error SomeError(bytes32 invalidHash)
```

Invalid hash.
*Reverts when hash has already been discovered.*




#### Parameters

| Name | Type | Description |
|---|---|---|
| invalidHash | bytes32 | Invalid hash. |


0 comments on commit d6c3f49

Please sign in to comment.