Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Sep 24, 2024
1 parent 2ff1532 commit ac96452
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 671 deletions.
3 changes: 1 addition & 2 deletions contracts/base/ModuleManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import { IValidator } from "../interfaces/modules/IValidator.sol";
import { CallType, CALLTYPE_SINGLE, CALLTYPE_STATIC } from "../lib/ModeLib.sol";
import { LocalCallDataParserLib } from "../lib/local/LocalCallDataParserLib.sol";
import { IModuleManagerEventsAndErrors } from "../interfaces/base/IModuleManagerEventsAndErrors.sol";
import { MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, MODULE_TYPE_MULTI, MODULE_ENABLE_MODE_TYPE_HASH, ERC1271_MAGICVALUE, SUPPORTS_NESTED_TYPED_DATA_SIGN } from "contracts/types/Constants.sol";
import { MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, MODULE_TYPE_MULTI, MODULE_ENABLE_MODE_TYPE_HASH, ERC1271_MAGICVALUE } from "contracts/types/Constants.sol";
import { RegistryAdapter } from "./RegistryAdapter.sol";
import { IERC7739 } from "../interfaces/IERC7739.sol";
import { EIP712 } from "solady/src/utils/EIP712.sol";
import { ExcessivelySafeCall } from "excessively-safe-call/src/ExcessivelySafeCall.sol";
import { SentinelListLib } from "sentinellist/src/SentinelList.sol";
Expand Down
41 changes: 19 additions & 22 deletions contracts/modules/validators/K1Validator.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import { ERC7739Validator } from "../../base/ERC7739Validator.sol";
import { IValidator } from "../../interfaces/modules/IValidator.sol";
import { EnumerableSet } from "enumerableset4337/EnumerableSet4337.sol";
import { ERC1271_MAGICVALUE, ERC1271_INVALID } from "../../../contracts/types/Constants.sol";
import { MODULE_TYPE_VALIDATOR, VALIDATION_SUCCESS, VALIDATION_FAILED } from "../../../contracts/types/Constants.sol";
import { SignatureCheckerLib } from "solady/src/utils/SignatureCheckerLib.sol";
import { PackedUserOperation } from "account-abstraction/contracts/interfaces/PackedUserOperation.sol";
Expand Down Expand Up @@ -34,7 +33,7 @@ contract K1Validator is IValidator, ERC7739Validator {
/// @notice Mapping of smart account addresses to their respective owner addresses
mapping(address => address) public smartAccountOwners;

EnumerableSet.AddressSet private safeSenders;
EnumerableSet.AddressSet private _safeSenders;

/// @notice Error to indicate that no owner was provided during installation
error NoOwnerProvided();
Expand Down Expand Up @@ -74,12 +73,18 @@ contract K1Validator is IValidator, ERC7739Validator {

/**
* De-initialize the module with the given data
*
* @param data The data to de-initialize the module with
*/
function onUninstall(bytes calldata data) external override {
function onUninstall(bytes calldata) external override {
delete smartAccountOwners[msg.sender];
safeSenders.removeAll(msg.sender);
_safeSenders.removeAll(msg.sender);
}

/// @notice Transfers ownership of the validator to a new owner
/// @param newOwner The address of the new owner
function transferOwnership(address newOwner) external {
require(newOwner != address(0), ZeroAddressNotAllowed());
require(!_isContract(newOwner), NewOwnerIsContract());
smartAccountOwners[msg.sender] = newOwner;
}

/**
Expand All @@ -92,14 +97,6 @@ contract K1Validator is IValidator, ERC7739Validator {
return _isInitialized(smartAccount);
}

/// @notice Transfers ownership of the validator to a new owner
/// @param newOwner The address of the new owner
function transferOwnership(address newOwner) external {
require(newOwner != address(0), ZeroAddressNotAllowed());
require(!_isContract(newOwner), NewOwnerIsContract());
smartAccountOwners[msg.sender] = newOwner;
}

/*//////////////////////////////////////////////////////////////////////////
MODULE LOGIC
//////////////////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -162,14 +159,14 @@ contract K1Validator is IValidator, ERC7739Validator {
return _validateSignatureForOwner(owner, hash, sig);
}

/// @notice Adds a safe sender to the safeSenders list for the smart account
/// @notice Adds a safe sender to the _safeSenders list for the smart account
function addSafeSender(address sender) external {
safeSenders.add(msg.sender, sender);
_safeSenders.add(msg.sender, sender);
}

/// @notice Removes a safe sender from the safeSenders list for the smart account
/// @notice Removes a safe sender from the _safeSenders list for the smart account
function removeSafeSender(address sender) external {
safeSenders.remove(msg.sender, sender);
_safeSenders.remove(msg.sender, sender);
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -201,7 +198,7 @@ contract K1Validator is IValidator, ERC7739Validator {
return (
sender == 0x000000000000D9ECebf3C23529de49815Dac1c4c || // MulticallerWithSigner
sender == msg.sender || // Smart Account. Assume smart account never sends non safe eip-712 struct
safeSenders.contains(msg.sender, sender) // check if sender is in safeSenders for the Smart Account
_safeSenders.contains(msg.sender, sender) // check if sender is in _safeSenders for the Smart Account
);
}

Expand Down Expand Up @@ -247,10 +244,10 @@ contract K1Validator is IValidator, ERC7739Validator {
return size > 0;
}

// @notice Fills the safeSenders list from the given data
// @notice Fills the _safeSenders list from the given data
function _fillSafeSenders(bytes calldata data) private {
for (uint256 i; i < data.length / 20; i++) {
safeSenders.add(msg.sender, address(bytes20(data[20*i:20*(i+1)])));
_safeSenders.add(msg.sender, address(bytes20(data[20*i:20*(i+1)])));
}
}

Expand Down
276 changes: 0 additions & 276 deletions contracts/utils/AssociatedArrayLib.sol

This file was deleted.

Loading

0 comments on commit ac96452

Please sign in to comment.