Skip to content

Commit 307639c

Browse files
adamegyedjaypaik
authored andcommitted
fix: add doc and remove unused constant (#183)
1 parent fb62c12 commit 307639c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/helpers/ModuleEntityLib.sol

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
22
pragma solidity ^0.8.20;
33

44
import {ModuleEntity} from "../interfaces/IModularAccount.sol";
5+
// ModuleEntity is a packed representation of a module function
6+
// Layout:
7+
// 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA________________________ // Address
8+
// 0x________________________________________BBBBBBBB________________ // Entity ID
9+
// 0x________________________________________________0000000000000000 // unused
510

611
library ModuleEntityLib {
7-
// Magic value for hooks that should always revert.
8-
ModuleEntity internal constant _PRE_HOOK_ALWAYS_DENY = ModuleEntity.wrap(bytes24(uint192(2)));
9-
1012
function pack(address addr, uint32 entityId) internal pure returns (ModuleEntity) {
1113
return ModuleEntity.wrap(bytes24(bytes20(addr)) | bytes24(uint192(entityId)));
1214
}
1315

14-
function unpack(ModuleEntity fr) internal pure returns (address addr, uint32 entityId) {
15-
bytes24 underlying = ModuleEntity.unwrap(fr);
16+
function unpack(ModuleEntity moduleEntity) internal pure returns (address addr, uint32 entityId) {
17+
bytes24 underlying = ModuleEntity.unwrap(moduleEntity);
1618
addr = address(bytes20(underlying));
1719
entityId = uint32(bytes4(underlying << 160));
1820
}
1921

20-
function isEmpty(ModuleEntity fr) internal pure returns (bool) {
21-
return ModuleEntity.unwrap(fr) == bytes24(0);
22+
function isEmpty(ModuleEntity moduleEntity) internal pure returns (bool) {
23+
return ModuleEntity.unwrap(moduleEntity) == bytes24(0);
2224
}
2325

24-
function notEmpty(ModuleEntity fr) internal pure returns (bool) {
25-
return ModuleEntity.unwrap(fr) != bytes24(0);
26+
function notEmpty(ModuleEntity moduleEntity) internal pure returns (bool) {
27+
return ModuleEntity.unwrap(moduleEntity) != bytes24(0);
2628
}
2729

2830
function eq(ModuleEntity a, ModuleEntity b) internal pure returns (bool) {

0 commit comments

Comments
 (0)