-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,11 @@ error ZeroValue(); | |
/// @param expected Expected value. | ||
error LowerThan(uint256 provided, uint256 expected); | ||
|
||
/// @dev Failure of a native token transfer. | ||
/// @param to Address `to`. | ||
/// @param amount Token amount. | ||
error TransferFailed(address to, uint256 amount); | ||
|
||
/// @title WormholeRelayer - Smart contract for the contract interaction with wormhole relayer with any msg.value | ||
/// @author Aleksandr Kuperman - <[email protected]> | ||
/// @author Andrey Lebedev - <[email protected]> | ||
|
@@ -119,9 +124,11 @@ contract WormholeRelayer { | |
|
||
// Send leftover amount back to the sender, if any | ||
if (leftovers > 0) { | ||
// If the call fails, ignore to avoid the attack that would prevent this function from executing | ||
// solhint-disable-next-line avoid-low-level-calls | ||
tx.origin.call{value: leftovers}(""); | ||
(bool success, ) = tx.origin.call{value: leftovers}(""); | ||
if (!success) { | ||
revert TransferFailed(tx.origin, leftovers); | ||
} | ||
|
||
emit LeftoversRefunded(tx.origin, leftovers); | ||
} | ||
|