Skip to content

Commit

Permalink
Fix safeBalanceOf
Browse files Browse the repository at this point in the history
  • Loading branch information
zZoMROT committed May 2, 2023
1 parent 44ae2e6 commit 0bb3bbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/libraries/SafeERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ library SafeERC20 {
address account
) internal view returns(uint256 tokenBalance) {
bytes4 selector = IERC20.balanceOf.selector;
assembly ("memory-safe") {
assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
mstore(0x00, selector)
mstore(0x04, account)
let success := staticcall(gas(), token, 0x00, 0x24, 0x00, 0x20)
tokenBalance := mload(0)

if or(not(success), lt(returndatasize(), 0x20)) {
if or(iszero(success), lt(returndatasize(), 0x20)) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
Expand Down

0 comments on commit 0bb3bbb

Please sign in to comment.