% cat test.sol
contract A{
/**
* @custom:customfield
* @notice This is the notice
* @param a This is a
* @param b This is b
*/
function test(uint a, uint b) public{
}
}
% cat test.py
from slither import Slither
sl = Slither("test.sol")
compilation_unit = sl.compilation_units[0]
natspec = compilation_unit.crytic_compile_compilation_unit.natspec["A"]
print(natspec.userdoc.export())
print(natspec.devdoc.export())
% python test.py
{'methods': {}, 'notice': None}
{'methods': {'test(uint256,uint256)': {'author': None, 'details': None, 'params': {'a': 'This is a', 'b': 'This is b'}, 'return': None}}, 'author': None, 'details': None, 'title': None}
Here we are missing some of the fields of the natspec, while they are provided by solc:
% solc test.sol --devdoc
{"kind":"dev","methods":{"test(uint256,uint256)":{"custom:customfield":"@notice This is the notice","params":{"a":"This is a","b":"This is b"}}},"version":1}
Here we are missing some of the fields of the natspec, while they are provided by solc: