@@ -10,18 +10,6 @@ import {
10
10
11
11
import { ConduitBatch1155Transfer } from "../conduit/lib/ConduitStructs.sol " ;
12
12
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
- */
25
13
contract TokenTransferrer is TokenTransferrerErrors {
26
14
/**
27
15
* @dev Internal function to transfer ERC20 tokens from a given originator
@@ -52,11 +40,6 @@ contract TokenTransferrer is TokenTransferrerErrors {
52
40
mstore (ERC20_transferFrom_amount_ptr , amount)
53
41
54
42
// 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.
60
43
let callStatus := call (
61
44
gas (),
62
45
token,
@@ -79,8 +62,8 @@ contract TokenTransferrer is TokenTransferrerErrors {
79
62
callStatus
80
63
)
81
64
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 .
84
67
// Equivalent to `or(iszero(success), iszero(returndatasize()))`
85
68
// but after it's inverted for JUMPI this expression is cheaper.
86
69
if iszero (and (success, iszero (iszero (returndatasize ())))) {
@@ -207,14 +190,14 @@ contract TokenTransferrer is TokenTransferrerErrors {
207
190
)
208
191
}
209
192
210
- // Otherwise, revert with error about token not having code:
193
+ // Otherwise revert with error about token not having code:
211
194
mstore (NoContract_error_sig_ptr, NoContract_error_signature)
212
195
mstore (NoContract_error_token_ptr, token)
213
196
revert (NoContract_error_sig_ptr, NoContract_error_length)
214
197
}
215
198
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
218
201
// technically ERC20 compliant.
219
202
}
220
203
@@ -764,8 +747,6 @@ contract TokenTransferrer is TokenTransferrerErrors {
764
747
765
748
// Reset the free memory pointer to the default value; memory must
766
749
// 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.
769
750
mstore (FreeMemoryPointerSlot, DefaultFreeMemoryPointer)
770
751
}
771
752
}
0 commit comments