Skip to content

Commit

Permalink
chore: better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsahu committed Oct 31, 2023
1 parent 9cd139c commit 8da6398
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions contracts/src/Allowlist.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,19 @@ contract AllowlistV1 is IAllowlistV1, Initializable, Administrable {
for (uint256 i = 0; i < _accounts.length;) {
LibSanitize._notZeroAddress(_accounts[i]);
// Check if it doesn't contain allow or deny permissions
if (
_permissions[i] & LibAllowlistMasks.DEPOSIT_MASK == 0
&& _permissions[i] & LibAllowlistMasks.DENY_MASK == 0
&& _permissions[i] & LibAllowlistMasks.REDEEM_MASK == 0
) {
revert LibErrors.Unauthorized(msg.sender);
}
require(
(_permissions[i] & LibAllowlistMasks.DENY_MASK) != LibAllowlistMasks.DENY_MASK,
"Cannot set deny permission"
);
require(
(_permissions[i] & LibAllowlistMasks.DEPOSIT_MASK) != LibAllowlistMasks.DEPOSIT_MASK,
"Cannot set deposit permission"
);
require(
(_permissions[i] & LibAllowlistMasks.REDEEM_MASK) != LibAllowlistMasks.REDEEM_MASK,
"Cannot set redeem permission"
);

Allowlist.set(_accounts[i], _permissions[i]);
unchecked {
++i;
Expand Down

0 comments on commit 8da6398

Please sign in to comment.