Skip to content

Commit

Permalink
feat: add fallback handler called event (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
r0ohafza authored Aug 15, 2024
1 parent e23179e commit 2bd83b5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/smart-vaults/src/utils/FallbackManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
/* -------------------------------------------------------------------------- */
Expand All @@ -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") {
Expand Down

0 comments on commit 2bd83b5

Please sign in to comment.