Skip to content

Commit

Permalink
style: standardize private vars in LightAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Dec 23, 2023
1 parent c9fd11a commit 682ecbb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/LightAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus
0x33e4b41198cc5b8053630ed667ea7c0c4c873f7fc8d9a478b5d7259cec0a4a00;
// bytes4(keccak256("isValidSignature(bytes32,bytes)"))
bytes4 internal constant _1271_MAGIC_VALUE = 0x1626ba7e;
IEntryPoint private immutable _entryPoint;
IEntryPoint private immutable _ENTRY_POINT;
// keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH =
bytes32 private constant _DOMAIN_SEPARATOR_TYPEHASH =
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
// keccak256("LightAccountMessage(bytes message)");
bytes32 private constant LA_MSG_TYPEHASH = 0x5e3baca2936049843f06038876a12f03627b5edc98025751ecf2ac7562640199;
bytes32 private constant _LA_MSG_TYPEHASH = 0x5e3baca2936049843f06038876a12f03627b5edc98025751ecf2ac7562640199;
bytes32 private constant _NAME_HASH = keccak256(bytes("LightAccount"));
bytes32 private constant _VERSION_HASH = keccak256(bytes("1"));

Expand Down Expand Up @@ -107,7 +107,7 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus
}

constructor(IEntryPoint anEntryPoint) CustomSlotInitializable(_INITIALIZABLE_STORAGE_POSITION) {
_entryPoint = anEntryPoint;
_ENTRY_POINT = anEntryPoint;
_disableInitializers();
}

Expand Down Expand Up @@ -185,7 +185,7 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus
/**
* @notice Called once as part of initialization, either during initial deployment or when first upgrading to
* this contract.
* @dev The _entryPoint member is immutable, to reduce gas consumption. To upgrade EntryPoint,
* @dev The _ENTRY_POINT member is immutable, to reduce gas consumption. To upgrade EntryPoint,
* a new implementation of LightAccount must be deployed with the new EntryPoint address, then upgrading
* the implementation by calling `upgradeTo()`
* @param anOwner The initial owner of the account
Expand All @@ -212,7 +212,7 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus

/// @inheritdoc BaseAccount
function entryPoint() public view virtual override returns (IEntryPoint) {
return _entryPoint;
return _ENTRY_POINT;
}

/**
Expand All @@ -238,7 +238,7 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus
function domainSeparator() public view returns (bytes32) {
return keccak256(
abi.encode(
DOMAIN_SEPARATOR_TYPEHASH,
_DOMAIN_SEPARATOR_TYPEHASH,
_NAME_HASH, // name
_VERSION_HASH, // version
block.chainid, // chainId
Expand All @@ -253,7 +253,7 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus
* @return Encoded message.
*/
function encodeMessageData(bytes memory message) public view returns (bytes memory) {
bytes32 messageHash = keccak256(abi.encode(LA_MSG_TYPEHASH, keccak256(message)));
bytes32 messageHash = keccak256(abi.encode(_LA_MSG_TYPEHASH, keccak256(message)));
return abi.encodePacked("\x19\x01", domainSeparator(), messageHash);
}

Expand Down Expand Up @@ -289,7 +289,7 @@ contract LightAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Cus
revert InvalidOwner(address(0));
}
_getStorage().owner = anOwner;
emit LightAccountInitialized(_entryPoint, anOwner);
emit LightAccountInitialized(_ENTRY_POINT, anOwner);
emit OwnershipTransferred(address(0), anOwner);
}

Expand Down

0 comments on commit 682ecbb

Please sign in to comment.