Skip to content

Commit

Permalink
🐛 Mask address args in STL
Browse files Browse the repository at this point in the history
  • Loading branch information
transmissions11 committed Jul 9, 2024
1 parent aebc05f commit eaa7041
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/SafeTransferLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ library SafeTransferLib {

// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(0, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(4, from) // Append the "from" argument.
mstore(36, to) // Append the "to" argument.
mstore(68, amount) // Append the "amount" argument.
mstore(4, and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument.
mstore(36, and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(68, amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

success := and(
// Set success to whether the call reverted, if not we check it either
Expand Down Expand Up @@ -74,8 +74,8 @@ library SafeTransferLib {

// Write the abi-encoded calldata into memory, beginning with the function selector.
mstore(0, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
mstore(4, to) // Append the "to" argument.
mstore(36, amount) // Append the "amount" argument.
mstore(4, and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
mstore(36, amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

success := and(
// Set success to whether the call reverted, if not we check it either
Expand Down

0 comments on commit eaa7041

Please sign in to comment.