From 839b4d1f7ccd15515c0c7b58440f5586e74eee4f Mon Sep 17 00:00:00 2001 From: jatZama Date: Wed, 22 Jan 2025 13:22:10 +0100 Subject: [PATCH] feat: add events to ACL chore: prettier test: forge test new event --- contracts/contracts/ACL.sol | 12 ++++++++++-- contracts/test/acl/acl.t.sol | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/contracts/contracts/ACL.sol b/contracts/contracts/ACL.sol index 8b0c46a..a5c4ccb 100644 --- a/contracts/contracts/ACL.sol +++ b/contracts/contracts/ACL.sol @@ -25,8 +25,15 @@ contract ACL is UUPSUpgradeable, Ownable2StepUpgradeable { error SenderNotAllowed(address sender); /// @notice Emitted when a list of handles is allowed for decryption. + /// @param caller account calling the allowForDecryption function. /// @param handlesList List of handles allowed for decryption. - event AllowedForDecryption(uint256[] handlesList); + event AllowedForDecryption(address indexed caller, uint256[] handlesList); + + /// @notice Emitted when a handle is allowed. + /// @param caller account calling the allow function. + /// @param account account being allowed for the handle. + /// @param handle handle being allowed. + event Allowed(address indexed caller, address indexed account, uint256 handle); /// @notice Emitted when a new delegate address is added. /// @param sender Sender address @@ -76,6 +83,7 @@ contract ACL is UUPSUpgradeable, Ownable2StepUpgradeable { revert SenderNotAllowed(msg.sender); } $.persistedAllowedPairs[handle][account] = true; + emit Allowed(msg.sender, account, handle); } /** @@ -92,7 +100,7 @@ contract ACL is UUPSUpgradeable, Ownable2StepUpgradeable { } $.allowedForDecryption[handle] = true; } - emit AllowedForDecryption(handlesList); + emit AllowedForDecryption(msg.sender, handlesList); } /** diff --git a/contracts/test/acl/acl.t.sol b/contracts/test/acl/acl.t.sol index 5096b4b..dc753b1 100644 --- a/contracts/test/acl/acl.t.sol +++ b/contracts/test/acl/acl.t.sol @@ -166,7 +166,7 @@ contract ACLTest is Test { uint256[] memory handlesList = new uint256[](0); vm.prank(sender); vm.expectEmit(address(acl)); - emit ACL.AllowedForDecryption(handlesList); + emit ACL.AllowedForDecryption(address(sender), handlesList); acl.allowForDecryption(handlesList); } @@ -184,7 +184,7 @@ contract ACLTest is Test { vm.prank(sender); vm.expectEmit(address(acl)); - emit ACL.AllowedForDecryption(handlesList); + emit ACL.AllowedForDecryption(address(sender), handlesList); acl.allowForDecryption(handlesList); assertTrue(acl.isAllowedForDecryption(handle0));