Skip to content

Commit 3f4076e

Browse files
clean natspec and comments on AccountCore (#541)
* clean natspec and comments * run lint/prettier --------- Co-authored-by: Joaquim Verges <[email protected]>
1 parent 1ab6572 commit 3f4076e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

contracts/prebuilts/account/utils/AccountCore.sol

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,17 @@ contract AccountCore is IAccountCore, Initializable, Multicall, BaseAccount, Acc
7575
return entrypointContract;
7676
}
7777

78-
/// @notice Returns whether a signer is authorized to perform transactions using the wallet.
78+
/**
79+
@notice Returns whether a signer is authorized to perform transactions using the account.
80+
Validity of the signature is based upon signer permission start/end timestamps, txn target, and txn value.
81+
Account admins will always return true, and signers with address(0) as the only approved target will skip target checks.
82+
83+
@param _signer The signer to check.
84+
@param _userOp The user operation to check.
85+
86+
@return Whether the signer is authorized to perform the transaction.
87+
*/
88+
7989
/* solhint-disable*/
8090
function isValidSigner(address _signer, UserOperation calldata _userOp) public view virtual returns (bool) {
8191
// First, check if the signer is an admin.
@@ -102,6 +112,7 @@ contract AccountCore is IAccountCore, Initializable, Multicall, BaseAccount, Acc
102112
// if address(0) is the only approved target, set isWildCard to true (wildcard approved).
103113
bool isWildCard = approvedTargets.length() == 1 && approvedTargets.at(0) == address(0);
104114

115+
// checking target and value for `execute`
105116
if (sig == AccountExtension.execute.selector) {
106117
// Extract the `target` and `value` arguments from the calldata for `execute`.
107118
(address target, uint256 value) = decodeExecuteCalldata(_userOp.callData);
@@ -115,12 +126,14 @@ contract AccountCore is IAccountCore, Initializable, Multicall, BaseAccount, Acc
115126
}
116127
}
117128

118-
// Check if the value is within the allowed range and if the target is approved.
129+
// Check if the value is within the allowed range.
119130
if (permissions.nativeTokenLimitPerTransaction < value) {
120131
// Account: value too high OR Account: target not approved.
121132
return false;
122133
}
123-
} else if (sig == AccountExtension.executeBatch.selector) {
134+
}
135+
// checking target and value for `executeBatch`
136+
else if (sig == AccountExtension.executeBatch.selector) {
124137
// Extract the `target` and `value` array arguments from the calldata for `executeBatch`.
125138
(address[] memory targets, uint256[] memory values, ) = decodeExecuteBatchCalldata(_userOp.callData);
126139

@@ -134,7 +147,7 @@ contract AccountCore is IAccountCore, Initializable, Multicall, BaseAccount, Acc
134147
}
135148
}
136149

137-
// For each target+value pair, check if the value is within the allowed range and if the target is approved.
150+
// For each target+value pair, check if the value is within the allowed range.
138151
for (uint256 i = 0; i < targets.length; i++) {
139152
if (permissions.nativeTokenLimitPerTransaction < values[i]) {
140153
// Account: value too high OR Account: target not approved.

0 commit comments

Comments
 (0)