Skip to content

Commit

Permalink
chore: add suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Aug 3, 2023
1 parent 87184ab commit a0f48c2
Show file tree
Hide file tree
Showing 23 changed files with 878 additions and 1,140 deletions.
8 changes: 2 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ module.exports = {
mocha: true,
node: true,
},
extends: [
'airbnb-base',
],
extends: ['airbnb-base'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'@typescript-eslint',
],
plugins: ['@typescript-eslint'],
rules: {
'import/extensions': ['error', 'never'],
},
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ 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.
14 changes: 9 additions & 5 deletions examples/contracts/SomeOtherLibrary/SomeOtherLibrary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ error SomeError(bytes32 invalidHash);
/// @notice Some Other Error fired!!!!
error SomeOtherError();

/// @dev this is the third error.
/// @dev This is the third error.
/// The error does the following things:
/// - Shows you the `functionSelector`.
/// - Shows you the `functionMask`.
/// - Shows you an error.
/// @custom:danger Be careful, this Error is dangerous!
/// @param functionSelector This is a function selector
/// @param fucntionMask This is a function mask
error ThirdError(bytes4 functionSelector, uint256 fucntionMask);
/// @param functionMask This is a function mask
error ThirdError(bytes4 functionSelector, uint256 functionMask);

error WhateverError(bytes16 somethingElse);
error ErrorWithoutNatspec(bytes16 somethingElse);

library SomeOtherLibrary {
/// @dev This function uses `keccak256(..)` to hash text.
Expand All @@ -32,4 +36,4 @@ library SomeOtherLibrary {
function someOtherFunction(string memory someText) internal pure returns(bytes32 hash) {
return sha256(bytes(someText));
}
}
}
308 changes: 154 additions & 154 deletions examples/docs/contracts/Bar.json
Original file line number Diff line number Diff line change
@@ -1,164 +1,164 @@
{
"methods": {
"constructor": {
"stateMutability": "nonpayable",
"code": "constructor(uint256 someNumber)",
"inputs": {
"someNumber": {
"type": "uint256",
"description": "The description of the parameter"
}
},
"outputs": {},
"notice": "This is the notice of the constructor",
"details": "This is a constructor",
"custom:tip": "A custom blah tag"
},
"fallback()": {
"stateMutability": "nonpayable",
"code": "fallback(bytes calldata fallbackParam) external nonpayable returns (bytes memory testtest)",
"inputs": {
"fallbackParam": {
"type": "bytes",
"description": "some details about the param"
}
},
"outputs": {
"testtest": {
"type": "bytes",
"description": "result some details about the result"
}
},
"details": "This is a fallback",
"notice": "This is the notice of the fallback",
"custom:warning": "the fallback function can return some data via assembly, but it will not be abi-encoded\n ",
"custom:hey": "hey hey hey\n ",
"custom:ho": "ho ho ho"
},
"baap(uint256,address)": {
"stateMutability": "nonpayable",
"code": "function baap(uint256 bar, address aar) external nonpayable",
"inputs": {
"bar": {
"type": "uint256",
"description": "Number of bar"
},
"aar": {
"type": "address",
"description": "Address of aar"
}
},
"outputs": {},
"notice": "Baaps the yaps"
},
"boop(uint256)": {
"stateMutability": "nonpayable",
"code": "function boop(uint256 bar) external nonpayable",
"inputs": {
"bar": {
"type": "uint256"
}
},
"outputs": {},
"notice": "Cool function bro",
"custom:requirement": "Check first requirementCheck second requirement"
},
"boop(uint256,uint256)": {
"stateMutability": "nonpayable",
"code": "function boop(uint256 bar, uint256 bar2) external nonpayable",
"inputs": {
"bar": {
"type": "uint256"
},
"bar2": {
"type": "uint256"
}
},
"outputs": {},
"notice": "Alt cool function bro"
},
"hello(bytes)": {
"stateMutability": "nonpayable",
"code": "function hello(bytes someCallData) external nonpayable",
"inputs": {
"someCallData": {
"type": "bytes",
"description": "hello tic tac toe"
}
},
"outputs": {}
},
"set(tuple)": {
"stateMutability": "nonpayable",
"code": "function set(IBar.T t) external nonpayable",
"inputs": {
"t": {
"type": "IBar.T"
}
},
"outputs": {}
"methods": {
"constructor": {
"stateMutability": "nonpayable",
"code": "constructor(uint256 someNumber)",
"inputs": {
"someNumber": {
"type": "uint256",
"description": "The description of the parameter"
}
},
"outputs": {},
"notice": "This is the notice of the constructor",
"details": "This is a constructor",
"custom:tip": "A custom blah tag"
},
"fallback()": {
"stateMutability": "nonpayable",
"code": "fallback(bytes calldata fallbackParam) external nonpayable returns (bytes memory testtest)",
"inputs": {
"fallbackParam": {
"type": "bytes",
"description": "some details about the param"
}
},
"outputs": {
"testtest": {
"type": "bytes",
"description": "result some details about the result"
}
},
"details": "This is a fallback",
"notice": "This is the notice of the fallback",
"custom:warning": "the fallback function can return some data via assembly, but it will not be abi-encoded\n ",
"custom:hey": "hey hey hey\n ",
"custom:ho": "ho ho ho"
},
"baap(uint256,address)": {
"stateMutability": "nonpayable",
"code": "function baap(uint256 bar, address aar) external nonpayable",
"inputs": {
"bar": {
"type": "uint256",
"description": "Number of bar"
},
"receive()": {
"stateMutability": "payable",
"code": "receive() external payable",
"inputs": {},
"outputs": {},
"details": "This is a `receive()` function",
"notice": "This is the notice of the `receive()` function",
"custom:info": "if sending native tokens with some graffiti, check the {`fallback()`} function documentation."
"aar": {
"type": "address",
"description": "Address of aar"
}
},
"outputs": {},
"notice": "Baaps the yaps"
},
"events": {
"Transfer": {
"code": "event Transfer(uint256 foo)",
"inputs": {
"foo": {
"type": "uint256",
"indexed": false,
"description": "Amount of stuff"
}
},
"notice": "Emitted when transfer",
"details": "Transfer some stuff",
"custom:danger": "This event exposes private info"
"boop(uint256)": {
"stateMutability": "nonpayable",
"code": "function boop(uint256 bar) external nonpayable",
"inputs": {
"bar": {
"type": "uint256"
}
},
"outputs": {},
"notice": "Cool function bro",
"custom:requirement": "Check first requirementCheck second requirement"
},
"boop(uint256,uint256)": {
"stateMutability": "nonpayable",
"code": "function boop(uint256 bar, uint256 bar2) external nonpayable",
"inputs": {
"bar": {
"type": "uint256"
},
"bar2": {
"type": "uint256"
}
},
"outputs": {},
"notice": "Alt cool function bro"
},
"errors": {
"Doh": {
"code": "error Doh(bool yay)",
"inputs": {
"yay": {
"type": "bool",
"description": "A bool"
}
},
"notice": "Thrown when doh",
"details": "Bad doh error",
"custom:info": "Additional info"
"hello(bytes)": {
"stateMutability": "nonpayable",
"code": "function hello(bytes someCallData) external nonpayable",
"inputs": {
"someCallData": {
"type": "bytes",
"description": "hello tic tac toe"
}
},
"outputs": {}
},
"internalMethods": {
"_baap(uint256,address)": {
"code": "function _baap(uint256 bar, address aar) internal nonpayable",
"inputs": {
"bar": {
"type": "uint256",
"description": "Number of bar"
},
"aar": {
"type": "address",
"description": "Address of aar"
}
},
"outputs": {},
"notice": "Baaps the yaps internally"
"set(tuple)": {
"stateMutability": "nonpayable",
"code": "function set(IBar.T t) external nonpayable",
"inputs": {
"t": {
"type": "IBar.T"
}
},
"outputs": {}
},
"path": "",
"title": "Bar contract",
"notice": "Manages the bar",
"details": "Blablou",
"author": "Primitive",
"custom:version": "v2.0.1",
"name": "Bar"
}
"receive()": {
"stateMutability": "payable",
"code": "receive() external payable",
"inputs": {},
"outputs": {},
"details": "This is a `receive()` function",
"notice": "This is the notice of the `receive()` function",
"custom:info": "if sending native tokens with some graffiti, check the {`fallback()`} function documentation."
}
},
"events": {
"Transfer": {
"code": "event Transfer(uint256 foo)",
"inputs": {
"foo": {
"type": "uint256",
"indexed": false,
"description": "Amount of stuff"
}
},
"notice": "Emitted when transfer",
"details": "Transfer some stuff",
"custom:danger": "This event exposes private info"
}
},
"errors": {
"Doh": {
"code": "error Doh(bool yay)",
"inputs": {
"yay": {
"type": "bool",
"description": "A bool"
}
},
"notice": "Thrown when doh",
"details": "Bad doh error",
"custom:info": "Additional info"
}
},
"internalMethods": {
"_baap(uint256,address)": {
"code": "function _baap(uint256 bar, address aar) internal nonpayable",
"inputs": {
"bar": {
"type": "uint256",
"description": "Number of bar"
},
"aar": {
"type": "address",
"description": "Address of aar"
}
},
"outputs": {},
"notice": "Baaps the yaps internally"
}
},
"path": "",
"title": "Bar contract",
"notice": "Manages the bar",
"details": "Blablou",
"author": "Primitive",
"custom:version": "v2.0.1",
"name": "Bar"
}
Loading

0 comments on commit a0f48c2

Please sign in to comment.