@@ -84,21 +84,6 @@ contract InternalLogic is Tstorish {
84
84
_PERMIT2_INITIALLY_DEPLOYED = _checkPermit2Deployment ();
85
85
}
86
86
87
- function _emitClaim (address sponsor , bytes32 messageHash , address allocator ) internal {
88
- assembly ("memory-safe" ) {
89
- mstore (0 , messageHash)
90
- log4 (0 , 0x20 , _CLAIM_EVENT_SIGNATURE, shr (0x60 , shl (0x60 , sponsor)), shr (0x60 , shl (0x60 , allocator)), caller ())
91
- }
92
- }
93
-
94
- function _notExpiredAndSignedByAllocator (bytes32 messageHash , address allocator , BasicTransfer calldata transferPayload ) internal {
95
- transferPayload.expires.later ();
96
-
97
- messageHash.signedBy (allocator, transferPayload.allocatorSignature, _INITIAL_DOMAIN_SEPARATOR.toLatest (_INITIAL_CHAIN_ID));
98
-
99
- _emitClaim (msg .sender , messageHash, allocator);
100
- }
101
-
102
87
function _setReentrancyGuard () internal {
103
88
_setTstorish (_REENTRANCY_GUARD_SLOT, 1 );
104
89
}
@@ -107,105 +92,6 @@ contract InternalLogic is Tstorish {
107
92
_clearTstorish (_REENTRANCY_GUARD_SLOT);
108
93
}
109
94
110
- function _register (address sponsor , bytes32 claimHash , bytes32 typehash , uint256 duration ) internal {
111
- assembly ("memory-safe" ) {
112
- let m := mload (0x40 )
113
- mstore (add (m, 0x14 ), sponsor)
114
- mstore (m, _ACTIVE_REGISTRATIONS_SCOPE)
115
- mstore (add (m, 0x34 ), claimHash)
116
- mstore (add (m, 0x54 ), typehash)
117
- let cutoffSlot := keccak256 (add (m, 0x1c ), 0x58 )
118
-
119
- let expires := add (timestamp (), duration)
120
- if or (lt (expires, sload (cutoffSlot)), gt (duration, 0x278d00 )) {
121
- // revert InvalidRegistrationDuration(uint256 duration)
122
- mstore (0 , 0x1f9a96f4 )
123
- mstore (0x20 , duration)
124
- revert (0x1c , 0x24 )
125
- }
126
-
127
- sstore (cutoffSlot, expires)
128
- mstore (add (m, 0x74 ), expires)
129
- log2 (add (m, 0x34 ), 0x60 , _COMPACT_REGISTERED_SIGNATURE, shr (0x60 , shl (0x60 , sponsor)))
130
- }
131
- }
132
-
133
- function _registerWithDefaults (bytes32 claimHash , bytes32 typehash ) internal {
134
- _register (msg .sender , claimHash, typehash, uint256 (0x258 ).asStubborn ());
135
- }
136
-
137
- function _registerBatch (bytes32 [2 ][] calldata claimHashesAndTypehashes , uint256 duration ) internal returns (bool ) {
138
- unchecked {
139
- uint256 totalClaimHashes = claimHashesAndTypehashes.length ;
140
- for (uint256 i = 0 ; i < totalClaimHashes; ++ i) {
141
- bytes32 [2 ] calldata claimHashAndTypehash = claimHashesAndTypehashes[i];
142
- _register (msg .sender , claimHashAndTypehash[0 ], claimHashAndTypehash[1 ], duration);
143
- }
144
- }
145
-
146
- return true ;
147
- }
148
-
149
- function _consume (uint256 [] calldata nonces ) internal returns (bool ) {
150
- // NOTE: this may not be necessary, consider removing
151
- msg .sender .usingAllocatorId ().mustHaveARegisteredAllocator ();
152
-
153
- unchecked {
154
- uint256 i;
155
-
156
- assembly ("memory-safe" ) {
157
- i := nonces.offset
158
- }
159
-
160
- uint256 end = i + (nonces.length << 5 );
161
- uint256 nonce;
162
- for (; i < end; i += 0x20 ) {
163
- assembly ("memory-safe" ) {
164
- nonce := calldataload (i)
165
- }
166
- nonce.consumeNonceAsAllocator (msg .sender );
167
- }
168
- }
169
-
170
- return true ;
171
- }
172
-
173
- function _registerAllocator (address allocator , bytes calldata proof ) internal returns (uint96 allocatorId ) {
174
- allocator = uint256 (uint160 (allocator)).asSanitizedAddress ();
175
- if (! allocator.canBeRegistered (proof)) {
176
- assembly ("memory-safe" ) {
177
- // revert InvalidRegistrationProof(allocator)
178
- mstore (0 , 0x4e7f492b )
179
- mstore (0x20 , allocator)
180
- revert (0x1c , 0x24 )
181
- }
182
- }
183
-
184
- allocatorId = allocator.register ();
185
- }
186
-
187
- function _getLockDetails (uint256 id ) internal view returns (address token , address allocator , ResetPeriod resetPeriod , Scope scope ) {
188
- token = id.toToken ();
189
- allocator = id.toAllocatorId ().toRegisteredAllocator ();
190
- resetPeriod = id.toResetPeriod ();
191
- scope = id.toScope ();
192
- }
193
-
194
- function _hasConsumedAllocatorNonce (uint256 nonce , address allocator ) internal view returns (bool ) {
195
- return allocator.hasConsumedAllocatorNonce (nonce);
196
- }
197
-
198
- function _getRegistrationStatus (address sponsor , bytes32 claimHash , bytes32 typehash ) internal view returns (uint256 expires ) {
199
- assembly ("memory-safe" ) {
200
- let m := mload (0x40 )
201
- mstore (add (m, 0x14 ), sponsor)
202
- mstore (m, _ACTIVE_REGISTRATIONS_SCOPE)
203
- mstore (add (m, 0x34 ), claimHash)
204
- mstore (add (m, 0x54 ), typehash)
205
- expires := sload (keccak256 (add (m, 0x1c ), 0x58 ))
206
- }
207
- }
208
-
209
95
function _isPermit2Deployed () internal view returns (bool ) {
210
96
if (_PERMIT2_INITIALLY_DEPLOYED) {
211
97
return true ;
0 commit comments