Skip to content

Commit

Permalink
modify _isPayable to be compiler agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabnock01 committed Jul 3, 2023
1 parent 0b3b438 commit 508abbb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/StdCheats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 508abbb

Please sign in to comment.