Skip to content

Commit

Permalink
Merge pull request #951 from lukso-network/chore-tokenIdDataLocation
Browse files Browse the repository at this point in the history
refactor: Use new data location for LSP8 tokenId data
  • Loading branch information
CJ42 authored Apr 4, 2024
2 parents de15120 + abecb45 commit 39108d2
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 39108d2

Please sign in to comment.