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

refactor: Use new data location for LSP8 tokenId data #951

Merged
merged 1 commit into from
Apr 4, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
// Mapping a `tokenId` to its authorized operator addresses.
mapping(bytes32 => EnumerableSet.AddressSet) internal _operators;

// Mapping from `tokenId` to `dataKey` to `dataValue`
mapping(bytes32 => mapping(bytes32 => bytes)) internal _tokenIdData;

// --- Token queries

/**
Expand Down Expand Up @@ -683,7 +686,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
bytes32 dataKey,
bytes memory dataValue
) internal virtual {
_store[keccak256(bytes.concat(tokenId, dataKey))] = dataValue;
_tokenIdData[tokenId][dataKey] = dataValue;
emit TokenIdDataChanged(tokenId, dataKey, dataValue);
}

Expand All @@ -698,7 +701,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
bytes32 tokenId,
bytes32 dataKey
) internal view virtual returns (bytes memory dataValues) {
return _store[keccak256(bytes.concat(tokenId, dataKey))];
return _tokenIdData[tokenId][dataKey];
}

/**
Expand Down
Loading