-
Notifications
You must be signed in to change notification settings - Fork 169
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
38fe538
ff4dd4f
ad24f84
50636ed
688b242
9d40424
2a54021
eca0d50
ce61955
8e9e569
cc564f9
d0b743b
35212b8
8cf4a81
37dc690
946288b
5c44e50
23b1a74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,15 +224,6 @@ function overrideRawSignatureValidation(c: ContractBuilder, opts: AccountOptions | |
}); | ||
c.addOverride({ name: 'AbstractSigner' }, signerFunctions._rawSignatureValidation); | ||
c.addOverride({ name: 'AccountERC7579' }, signerFunctions._rawSignatureValidation); | ||
c.setFunctionComments( | ||
[ | ||
`// IMPORTANT: Make sure Signer${opts.signer} is most derived than AccountERC7579`, | ||
`// in the inheritance chain (i.e. contract ... is AccountERC7579, ..., Signer${opts.signer})`, | ||
'// to ensure the correct order of function resolution.', | ||
'// AccountERC7579 returns false for `_rawSignatureValidation`', | ||
], | ||
signerFunctions._rawSignatureValidation, | ||
); | ||
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. Any reason to remove this? It's an important consideration for anyone copy pastes the code 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. Sorry for that. I have reverted it back |
||
// Base override for `_rawSignatureValidation` given MultiSignerERC7913Weighted is MultiSignerERC7913 | ||
if (opts.signer === 'MultisigWeighted') { | ||
c.addImportOnly(signers.Multisig); | ||
|
@@ -250,6 +241,12 @@ const functions = { | |
{ name: 'signature', type: 'bytes calldata' }, | ||
], | ||
returns: ['bytes4'], | ||
comments: [ | ||
'/// @dev Validates a signature for a given hash', | ||
'/// @param hash The hash to validate the signature for', | ||
'/// @param signature The signature to validate', | ||
'/// @return The magic value if the signature is valid, 0 otherwise', | ||
], | ||
}, | ||
_validateUserOp: { | ||
kind: 'internal' as const, | ||
|
@@ -258,6 +255,12 @@ const functions = { | |
{ name: 'userOpHash', type: 'bytes32' }, | ||
], | ||
returns: ['uint256'], | ||
comments: [ | ||
'/// @dev Validates a user operation', | ||
'/// @param userOp The user operation to validate', | ||
'/// @param userOpHash The hash of the user operation', | ||
'/// @return The validation data', | ||
], | ||
}, | ||
_erc7821AuthorizedExecutor: { | ||
kind: 'internal' as const, | ||
|
@@ -268,25 +271,40 @@ const functions = { | |
], | ||
returns: ['bool'], | ||
mutability: 'view' as const, | ||
comments: [ | ||
'/// @dev Checks if a caller is authorized to execute a specific operation', | ||
'/// @param caller The address of the caller', | ||
'/// @param mode The mode of operation', | ||
'/// @param executionData The data for the execution', | ||
'/// @return True if the caller is authorized, false otherwise', | ||
], | ||
}, | ||
addSigners: { | ||
kind: 'public' as const, | ||
args: [{ name: 'signers', type: 'bytes[] memory' }], | ||
comments: ['/// @dev Adds new signers to the account', '/// @param signers Array of signer data to add'], | ||
}, | ||
removeSigners: { | ||
kind: 'public' as const, | ||
args: [{ name: 'signers', type: 'bytes[] memory' }], | ||
comments: ['/// @dev Removes signers from the account', '/// @param signers Array of signer data to remove'], | ||
}, | ||
setThreshold: { | ||
kind: 'public' as const, | ||
args: [{ name: 'threshold', type: 'uint256' }], | ||
comments: ['/// @dev Sets the threshold for required signatures', '/// @param threshold The new threshold value'], | ||
}, | ||
setSignerWeights: { | ||
kind: 'public' as const, | ||
args: [ | ||
{ name: 'signers', type: 'bytes[] memory' }, | ||
{ name: 'weights', type: 'uint256[] memory' }, | ||
], | ||
comments: [ | ||
'/// @dev Sets the weights for signers', | ||
'/// @param signers Array of signer data', | ||
'/// @param weights Array of weights corresponding to each signer', | ||
], | ||
}, | ||
}), | ||
}; |
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,12 @@ export const functions = defineFunctions({ | |
{ name: 'to', type: 'address' }, | ||
{ name: 'value', type: 'uint256' }, | ||
], | ||
comments: [ | ||
'/// @dev Updates the balances of `from` and `to`', | ||
'/// @param from The address of the sender', | ||
'/// @param to The address of the recipient', | ||
'/// @param value The amount of tokens to transfer', | ||
], | ||
}, | ||
|
||
_approve: { | ||
|
@@ -430,6 +426,13 @@ 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 `value` as the allowance of `spender` over the `owner`'s tokens", | ||
'/// @param owner The address of the token owner', | ||
'/// @param spender The address of the spender', | ||
'/// @param value The amount of tokens to approve', | ||
'/// @param emitEvent Whether to emit the Approval event', | ||
], | ||
}, | ||
|
||
mint: { | ||
|
@@ -438,32 +441,56 @@ export const functions = defineFunctions({ | |
{ name: 'to', type: 'address' }, | ||
{ name: 'amount', type: 'uint256' }, | ||
], | ||
comments: [ | ||
'/// @dev Creates `amount` new tokens for `to`', | ||
'/// @param to The address that will receive the minted tokens', | ||
'/// @param amount The amount of tokens to mint', | ||
], | ||
}, | ||
|
||
pause: { | ||
kind: 'public' as const, | ||
args: [], | ||
comments: [ | ||
'/// @dev Pauses all token transfers', | ||
'/// @notice This function can only be called by the contract owner', | ||
], | ||
}, | ||
|
||
unpause: { | ||
kind: 'public' as const, | ||
args: [], | ||
comments: [ | ||
'/// @dev Unpauses all token transfers', | ||
'/// @notice This function can only be called by the contract owner', | ||
], | ||
}, | ||
|
||
snapshot: { | ||
kind: 'public' as const, | ||
args: [], | ||
comments: ['/// @dev Creates a new snapshot and returns its id', '/// @return The id of the new snapshot'], | ||
}, | ||
|
||
nonces: { | ||
kind: 'public' as const, | ||
args: [{ name: 'owner', type: 'address' }], | ||
returns: ['uint256'], | ||
mutability: 'view' as const, | ||
comments: [ | ||
'/// @dev Returns the current nonce for `owner`', | ||
'/// @param owner The address to get the nonce for', | ||
'/// @return The current nonce of the owner', | ||
], | ||
}, | ||
|
||
_checkTokenBridge: { | ||
kind: 'internal' as const, | ||
args: [{ name: 'caller', type: 'address' }], | ||
comments: [ | ||
'/// @dev Checks if the caller is a valid token bridge', | ||
'/// @param caller The address to check', | ||
'/// @notice This function is used for cross-chain token transfers', | ||
], | ||
}, | ||
}); |
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