-
Notifications
You must be signed in to change notification settings - Fork 168
Feat/59 add natspec descriptions #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mrscottyrose
wants to merge
18
commits into
OpenZeppelin:master
Choose a base branch
from
mrscottyrose:fix/59-add-natspec-descriptions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
38fe538
Add detailed comments to functions across multiple Solidity files for…
mrscottyrose ff4dd4f
Remove unnecessary comments from function definitions in Solidity fil…
mrscottyrose ad24f84
Refactor function definitions in Solidity files to enhance readabilit…
mrscottyrose 50636ed
Delete .changeset/salty-clowns-shake.md
mrscottyrose 688b242
Remove deprecated .changeset file and clean up Solidity function comm…
mrscottyrose 9d40424
update NatSpec comments to be more insightful
mrscottyrose 2a54021
revert back the args
mrscottyrose eca0d50
refactor: update NatSpec comments to be more insightful
mrscottyrose ce61955
fix: update mutability from 'pure' to 'view' for ERC721 functions and…
mrscottyrose 8e9e569
refactor: replace internal _burn function with public mint function i…
mrscottyrose cc564f9
refactor: replace internal _burn function with public mint function i…
mrscottyrose d0b743b
Update packages/core/solidity/src/erc721.ts
mrscottyrose 35212b8
Merge branch 'fix/59-add-natspec-descriptions' of https://github.com/…
mrscottyrose 8cf4a81
refactor: update mutability types, and remove unused internal mint fu…
mrscottyrose 37dc690
refactor: update mutability types, and remove unused internal mint fu…
mrscottyrose 946288b
clean duplicate comments and add the removed arguments
mrscottyrose 5c44e50
Merge branch 'fix/59-add-natspec-descriptions' of https://github.com/…
mrscottyrose 23b1a74
refactor: remove outdated NatSpec comments for _checkTokenBridge func…
mrscottyrose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
"@openzeppelin/contracts-wizard": patch | ||
--- | ||
Add NatSpec descriptions to generated contract functions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,16 +400,6 @@ function addSuperchainERC20(c: ContractBuilder) { | |
functions._checkTokenBridge, | ||
'pure', | ||
); | ||
c.setFunctionComments( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment text is still relevant for this scenario. It would be fine for it to overwrite the generic function comment for |
||
[ | ||
'/**', | ||
' * @dev Checks if the caller is the predeployed SuperchainTokenBridge. Reverts otherwise.', | ||
' *', | ||
' * IMPORTANT: The predeployed SuperchainTokenBridge is only available on chains in the Superchain.', | ||
' */', | ||
], | ||
functions._checkTokenBridge, | ||
); | ||
} | ||
|
||
export const functions = defineFunctions({ | ||
|
@@ -420,6 +410,9 @@ export const functions = defineFunctions({ | |
{ name: 'to', type: 'address' }, | ||
{ name: 'value', type: 'uint256' }, | ||
], | ||
comments: [ | ||
'/// @dev Hook that is called during any token transfer. This includes minting and burning. Override this function to add custom logic for token transfers.', | ||
], | ||
}, | ||
|
||
_approve: { | ||
|
@@ -430,6 +423,9 @@ export const functions = defineFunctions({ | |
{ name: 'value', type: 'uint256' }, | ||
{ name: 'emitEvent', type: 'bool' }, | ||
mrscottyrose marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
comments: [ | ||
'/// @dev Sets the allowance for a spender to spend tokens on behalf of an owner. This is an internal function that should be called from a public function with proper access control.', | ||
], | ||
}, | ||
|
||
mint: { | ||
|
@@ -438,32 +434,54 @@ export const functions = defineFunctions({ | |
{ name: 'to', type: 'address' }, | ||
{ name: 'amount', type: 'uint256' }, | ||
], | ||
comments: [ | ||
'/// @dev Creates new tokens and assigns them to the specified account. This function should be called with proper access control to restrict who can mint tokens.', | ||
], | ||
}, | ||
|
||
pause: { | ||
kind: 'public' as const, | ||
args: [], | ||
comments: [ | ||
'/// @dev Pauses all token transfers.', | ||
'/// Consider implementing access control to restrict who can pause.', | ||
], | ||
}, | ||
|
||
unpause: { | ||
kind: 'public' as const, | ||
args: [], | ||
comments: [ | ||
'/// @dev Unpauses all token transfers.', | ||
'/// Consider implementing access control to restrict who can unpause.', | ||
], | ||
}, | ||
|
||
snapshot: { | ||
kind: 'public' as const, | ||
args: [], | ||
comments: [ | ||
'/// @dev Creates a new snapshot and returns its id.', | ||
'/// Consider implementing access control to restrict who can create snapshots.', | ||
], | ||
}, | ||
|
||
nonces: { | ||
kind: 'public' as const, | ||
args: [{ name: 'owner', type: 'address' }], | ||
returns: ['uint256'], | ||
mutability: 'view' as const, | ||
comments: [ | ||
'/// @dev Returns the current nonce for an owner.', | ||
'/// Used for permit signatures to prevent replay attacks.', | ||
], | ||
}, | ||
|
||
_checkTokenBridge: { | ||
kind: 'internal' as const, | ||
args: [{ name: 'caller', type: 'address' }], | ||
comments: [ | ||
'/// @dev Validates if the caller is an authorized token bridge. This is used for cross-chain token transfers to ensure only trusted bridges can move tokens.', | ||
], | ||
}, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing detailed change-set description