From 73b46e3bd18f489392aeda172a4ecf501d677cd5 Mon Sep 17 00:00:00 2001 From: Arr00 <13561405+arr00@users.noreply.github.com> Date: Tue, 17 Dec 2024 06:48:40 -0500 Subject: [PATCH] Bubble up revert data on failed `Address.sendValue` (#5379) --- .changeset/cyan-taxis-travel.md | 5 +++++ contracts/utils/Address.sol | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/cyan-taxis-travel.md diff --git a/.changeset/cyan-taxis-travel.md b/.changeset/cyan-taxis-travel.md new file mode 100644 index 000000000..bd90e07f3 --- /dev/null +++ b/.changeset/cyan-taxis-travel.md @@ -0,0 +1,5 @@ +--- +'openzeppelin-solidity': minor +--- + +`Address`: bubble up revert data on `sendValue` failed call diff --git a/contracts/utils/Address.sol b/contracts/utils/Address.sol index a1c8af296..d8e887491 100644 --- a/contracts/utils/Address.sol +++ b/contracts/utils/Address.sol @@ -35,9 +35,9 @@ library Address { revert Errors.InsufficientBalance(address(this).balance, amount); } - (bool success, ) = recipient.call{value: amount}(""); + (bool success, bytes memory returndata) = recipient.call{value: amount}(""); if (!success) { - revert Errors.FailedCall(); + _revert(returndata); } }