Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fallback handler called event #42

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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