Skip to content

Commit

Permalink
fix: address allowlist can be set independently of spend limits
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Nov 8, 2024
1 parent cd5433a commit 5b9dbd7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/modules/permissions/AllowlistModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ contract AllowlistModule is IExecutionHookModule, IValidationHookModule, ModuleB
setSelectorAllowlist(entityId, address(0), input.selectors[j], true);
}
} else {
setAddressAllowlist(entityId, input.target, true, input.hasSelectorAllowlist);
setAddressAllowlist(
entityId, input.target, true, input.hasSelectorAllowlist, input.hasERC20SpendLimit
);
updateLimits(entityId, input.target, input.hasERC20SpendLimit, input.erc20SpendLimit);

if (input.hasSelectorAllowlist) {
Expand All @@ -228,7 +230,7 @@ contract AllowlistModule is IExecutionHookModule, IValidationHookModule, ModuleB
setSelectorAllowlist(entityId, input.target, input.selectors[j], false);
}
} else {
setAddressAllowlist(entityId, input.target, false, false);
setAddressAllowlist(entityId, input.target, false, false, false);
updateLimits(entityId, input.target, false, 0);

if (input.hasSelectorAllowlist) {
Expand All @@ -246,11 +248,17 @@ contract AllowlistModule is IExecutionHookModule, IValidationHookModule, ModuleB
/// @param target The target address.
/// @param allowed The new allowlist status, indicating whether or not the target address can be called.
/// @param hasSelectorAllowlist Whether or not the target address has a selector allowlist. If true, the
/// @param hasERC20SpendLimit Whether or not the target address has a ERC20 spend limit.
/// allowlist checking will validate that the selector is on the selector allowlist.
function setAddressAllowlist(uint32 entityId, address target, bool allowed, bool hasSelectorAllowlist)
public
{
AddressAllowlistEntry memory entry = AddressAllowlistEntry(allowed, hasSelectorAllowlist, false);
function setAddressAllowlist(
uint32 entityId,
address target,
bool allowed,
bool hasSelectorAllowlist,
bool hasERC20SpendLimit
) public {
AddressAllowlistEntry memory entry =
AddressAllowlistEntry(allowed, hasSelectorAllowlist, hasERC20SpendLimit);
addressAllowlist[entityId][target][msg.sender] = entry;
emit AddressAllowlistUpdated(entityId, msg.sender, target, entry);
}
Expand Down

0 comments on commit 5b9dbd7

Please sign in to comment.