Skip to content

Commit

Permalink
refactor: use new data location for LSP8 tokenId data
Browse files Browse the repository at this point in the history
  • Loading branch information
YamenMerhi committed Apr 4, 2024
1 parent de15120 commit abecb45
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 abecb45

Please sign in to comment.