From 2bd83b58e7a5cd0d6b3ce866670729df0748177b Mon Sep 17 00:00:00 2001 From: Rooh Afza <96720500+r0ohafza@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:07:04 -0700 Subject: [PATCH] feat: add fallback handler called event (#42) --- packages/smart-vaults/src/utils/FallbackManager.sol | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/smart-vaults/src/utils/FallbackManager.sol b/packages/smart-vaults/src/utils/FallbackManager.sol index b9d5020..f31f0cd 100644 --- a/packages/smart-vaults/src/utils/FallbackManager.sol +++ b/packages/smart-vaults/src/utils/FallbackManager.sol @@ -43,6 +43,11 @@ abstract contract FallbackManager is Receiver { /// @notice Event emitted when this contract receives ETH. event ReceiveEth(address indexed sender, uint256 amount); + /// @notice Event emitted when a call is made to a fallback handler. + event FallbackHandlerCalled( + address indexed sender, address indexed handler, bytes data, bool success, bytes result + ); + /* -------------------------------------------------------------------------- */ /* ERRORS */ /* -------------------------------------------------------------------------- */ @@ -66,7 +71,11 @@ abstract contract FallbackManager is Receiver { revert FunctionNotSupported(msg.sig); } - (bool success, bytes memory result) = handler.call(msg.data); + bytes calldata data = msg.data; + + (bool success, bytes memory result) = handler.call(data); + + emit FallbackHandlerCalled(msg.sender, handler, data, success, result); if (!success) { assembly ("memory-safe") {