Skip to content

Commit

Permalink
Move moduleOnly only to more straigthforward shape
Browse files Browse the repository at this point in the history
  • Loading branch information
cristovaoth committed Sep 28, 2023
1 parent 5f60895 commit 5bb10dc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions contracts/core/Modifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,10 @@ abstract contract Modifier is Module, IAvatar, EIP712Signature {
*/

modifier moduleOnly() {
bool wasSent = modules[msg.sender] != address(0);
bool wasSigned = !wasSent && modules[eip712SignedBy()] != address(0);
bool isAuthorized = wasSent || wasSigned;

if (!isAuthorized) {
revert NotAuthorized(msg.sender);
}

if (wasSigned) {
if (modules[msg.sender] == address(0)) {
if (modules[eip712SignedBy()] == address(0)) {
revert NotAuthorized(msg.sender);
}
eip712BumpNonce();
}

Expand Down

0 comments on commit 5bb10dc

Please sign in to comment.