From 508abbbf723a6e9d9cf0439597d1748f0842b503 Mon Sep 17 00:00:00 2001 From: Sabnock01 <24715302+Sabnock01@users.noreply.github.com> Date: Mon, 3 Jul 2023 15:46:03 -0500 Subject: [PATCH] modify _isPayable to be compiler agnostic --- src/StdCheats.sol | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/StdCheats.sol b/src/StdCheats.sol index 915e5bc9..e6d48804 100644 --- a/src/StdCheats.sol +++ b/src/StdCheats.sol @@ -279,8 +279,14 @@ abstract contract StdCheatsSafe { assumeAddressIsNot(addressType4, addr); } - function _isPayable(address addr) private returns (bool) { - if (addr.code.length == 0) { + function _isPayable(address addr) private returns (bool) { + uint256 size; + assembly { + size := extcodesize(addr) + } + + if (size == 0) { + // return false if no code return false; } else { require(addr.balance < type(uint256).max, "balance exceeds max uint256");