Skip to content

Commit 0ffe5f4

Browse files
Revert "Revert "Revert "Merge pull request ProjectOpenSea#505 from ProjectOpenSea/token-transferrer-comment-pass"""
This reverts commit 8cd4bbe.
1 parent 8654efc commit 0ffe5f4

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

contracts/lib/TokenTransferrer.sol

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ import {
1010

1111
import { ConduitBatch1155Transfer } from "../conduit/lib/ConduitStructs.sol";
1212

13-
/**
14-
* @title TokenTransferrer
15-
* @author 0age
16-
* @custom:coauthor d1ll0n
17-
* @custom:coauthor transmissions11
18-
* @notice TokenTransferrer is a library for performing optimized ERC20, ERC721,
19-
* ERC1155, and batch ERC1155 transfers, used by both Seaport as well as
20-
* by conduits deployed by the ConduitController. Use great caution when
21-
* considering these functions for use in other codebases, as there are
22-
* significant side effects and edge cases that need to be thoroughly
23-
* understood and carefully addressed.
24-
*/
2513
contract TokenTransferrer is TokenTransferrerErrors {
2614
/**
2715
* @dev Internal function to transfer ERC20 tokens from a given originator
@@ -52,11 +40,6 @@ contract TokenTransferrer is TokenTransferrerErrors {
5240
mstore(ERC20_transferFrom_amount_ptr, amount)
5341

5442
// Make call & copy up to 32 bytes of return data to scratch space.
55-
// Scratch space does not need to be cleared ahead of time, as the
56-
// subsequent check will ensure that either at least a full word of
57-
// return data is received (in which case it will be overwritten) or
58-
// that no data is received (in which case scratch space will be
59-
// ignored) on a successful call to the given token.
6043
let callStatus := call(
6144
gas(),
6245
token,
@@ -79,8 +62,8 @@ contract TokenTransferrer is TokenTransferrerErrors {
7962
callStatus
8063
)
8164

82-
// Handle cases where either the transfer failed or no data was
83-
// returned. Group these, as most transfers will succeed with data.
65+
// If the transfer failed or it returned nothing:
66+
// Group these because they should be uncommon.
8467
// Equivalent to `or(iszero(success), iszero(returndatasize()))`
8568
// but after it's inverted for JUMPI this expression is cheaper.
8669
if iszero(and(success, iszero(iszero(returndatasize())))) {
@@ -207,14 +190,14 @@ contract TokenTransferrer is TokenTransferrerErrors {
207190
)
208191
}
209192

210-
// Otherwise, revert with error about token not having code:
193+
// Otherwise revert with error about token not having code:
211194
mstore(NoContract_error_sig_ptr, NoContract_error_signature)
212195
mstore(NoContract_error_token_ptr, token)
213196
revert(NoContract_error_sig_ptr, NoContract_error_length)
214197
}
215198

216-
// Otherwise, the token just returned no data despite the call
217-
// having succeeded; no need to optimize for this as it's not
199+
// Otherwise the token just returned nothing but otherwise
200+
// succeeded; no need to optimize for this as it's not
218201
// technically ERC20 compliant.
219202
}
220203

@@ -764,8 +747,6 @@ contract TokenTransferrer is TokenTransferrerErrors {
764747

765748
// Reset the free memory pointer to the default value; memory must
766749
// be assumed to be dirtied and not reused from this point forward.
767-
// Also note that the zero slot is not reset to zero, meaning empty
768-
// arrays cannot be safely created or utilized until it is restored.
769750
mstore(FreeMemoryPointerSlot, DefaultFreeMemoryPointer)
770751
}
771752
}

0 commit comments

Comments
 (0)