Open
Conversation
MoMannn
requested changes
Jun 10, 2025
MoMannn
requested changes
Jun 10, 2025
MoMannn
previously approved these changes
Jun 17, 2025
MoMannn
requested changes
Jul 8, 2025
| event IncreasedSpentMap(address indexed sender, bytes32 indexed delegationHash, uint256 tokenId, uint256 limit, uint256 spent); | ||
|
|
||
| /** | ||
| * @notice Enforces that the contract and tokenIds are permitted for transfer |
Contributor
There was a problem hiding this comment.
contract, tokenIds and amounts
| /** | ||
| * @notice Enforces that the contract and tokenIds are permitted for transfer | ||
| * @dev Validates that the transfer execution matches the permitted terms and updates spent amounts | ||
| * @param _terms encoded terms containing transfer type, contract address, token IDs and amounts |
Contributor
There was a problem hiding this comment.
terms don't include transfer type anymore since its extracted via bytes length
| /** | ||
| * @notice Decodes the terms to get the transfer type, permitted contract and token IDs | ||
| * @dev Validates the terms length and structure | ||
| * @param _terms The encoded terms containing transfer type, contract address and token IDs |
Contributor
There was a problem hiding this comment.
no transfer type here as well
| if (callData_.length != 196 && callData_.length < 324) revert("ERC1155TransferEnforcer:invalid-calldata-length"); | ||
| if (target_ != permittedContract_) revert("ERC1155TransferEnforcer:unauthorized-contract-target"); | ||
|
|
||
| bytes4 selector_ = bytes4(callData_[0:4]); |
Contributor
There was a problem hiding this comment.
I think writting this this way:
if (isBatch_) {
if (selector_ != IERC1155.safeBatchTransferFrom.selector) {
revert("ERC1155TransferEnforcer:unauthorized-selector-batch");
}
_validateBatchTransfer(_delegationHash, callData_, permittedTokenIds_, permittedAmounts_);
} else {
if (selector_ != IERC1155.safeTransferFrom.selector) {
revert("ERC1155TransferEnforcer:unauthorized-selector-single");
}
_validateSingleTransfer(_delegationHash, callData_, permittedTokenIds_[0], permittedAmounts_[0]);
}
Should be slightly better gas wise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Why?
How?