Skip to content

Commit

Permalink
Update SafeTransferLib.sol
Browse files Browse the repository at this point in the history
nit comments
  • Loading branch information
z0r0z committed Mar 21, 2022
1 parent f3181c2 commit c56b766
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libraries/SafeTransferLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ library SafeTransferLib {
freeMemoryPointer,
0xa9059cbb00000000000000000000000000000000000000000000000000000000
)
mstore(add(freeMemoryPointer, 4), to) // append the 'to' argument
mstore(add(freeMemoryPointer, 36), amount) // append the 'amount' argument
mstore(add(freeMemoryPointer, 4), to) // append the "to" argument
mstore(add(freeMemoryPointer, 36), amount) // append the "amount" argument

success := and(
// set success to whether the call reverted, if not we check it either
// returned exactly 1 (not just any non-zero data), or had no return data
// returned exactly 1 (can't just be non-zero data), or had no return data
or(
and(eq(mload(0), 1), gt(returndatasize(), 31)),
iszero(returndatasize())
),
// we use 68 because the length of our calldata totals up like so: 4 + 32 * 2
// we use 0 and 32 to copy up to 32 bytes of return data into the scratch space
// counterintuitively, this call must be positioned second to the addition in the
// order of operations or else returndatasize() will be zero during the computation
// counterintuitively, this call must be positioned second to the or() call in the
// surrounding and() call or else returndatasize() will be zero during the computation
call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
)
}
Expand Down

0 comments on commit c56b766

Please sign in to comment.