Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

liron's little fixes #1348

Draft
wants to merge 3 commits into
base: feat/cleanup_client_init
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions contracts/src/protocol/SemiFungible1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ contract SemiFungible1155 is
* @dev Upper 128 bits identify base type ID, lower bits should be 0.
*/
function isBaseType(uint256 tokenID) internal pure returns (bool) {
return (tokenID & TYPE_MASK == tokenID) && (tokenID & NF_INDEX_MASK == 0);
return (tokenID & NF_INDEX_MASK == 0);
}

/**
Expand Down Expand Up @@ -288,7 +288,6 @@ contract SemiFungible1155 is
* @param _account The address of the account that will receive the new tokens.
* @param _tokenID The ID of the token to split.
* @param _values An array of numbers of units associated with the new tokens.
* @dev This function splits a token into multiple tokens with different unit values.
* @dev The `_values` array specifies the number of units associated with each new token.
* @dev The function checks that the length of the `_values` array is between 2 and `FRACTION_LIMIT`, and that the
* sum of the values in the `_values` array is equal to the number of units associated with the original token.
Expand Down Expand Up @@ -537,7 +536,7 @@ contract SemiFungible1155 is
uint256 _from = fromIDs[i];
uint256 _to = toIDs[i];

if (isBaseType(_from)) revert Errors.NotAllowed();
if (isBaseType(_from) || isBaseType(_to)) revert Errors.NotAllowed();
if (getBaseType(_from) != getBaseType(_to)) revert Errors.TypeMismatch();
unchecked {
++i;
Expand Down