Emitting incorrect event value
The `LibShortRecord::burnNFT()` emits an incorrect event value.\\nThe `burnNFT()` emits an incorrect event value: `nft.owner`. Specifically, the `nft` variable will point to the storage object specified by the `tokenId`. However, the pointing storage object will be deleted before emitting the `Transfer` event.\\nSubsequently, the `ERC721::Transfer` event will be emitted with `nft.owner` == `address(0)`.\\n```\\n    function burnNFT(uint256 tokenId) internal {\\n        //@dev No need to check downcast tokenId because it is handled in function that calls burnNFT\\n        AppStorage storage s = appStorage();\\n      STypes.NFT storage nft = s.nftMapping[tokenId];\\n        if (nft.owner == address(0)) revert Errors.NotMinted();\\n        address asset = s.assetMapping[nft.assetId];\\n        STypes.ShortRecord storage short =\\n            s.shortRecords[asset][nft.owner][nft.shortRecordId];\\n      delete s.nftMapping[tokenId];\\n        delete s.getApproved[tokenId];\\n        delete short.tokenId;\\n      emit Events.Transfer(nft.owner, address(0), tokenId);\\n    }\\n```\\n\\nhttps://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/libraries/LibShortRecord.sol#L366\\nhttps://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/libraries/LibShortRecord.sol#L371\\nhttps://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/libraries/LibShortRecord.sol#L374
Emit the `Transfer` event before the `delete` operations.\\n```\\n    function burnNFT(uint256 tokenId) internal {\\n        //@dev No need to check downcast tokenId because it is handled in function that calls burnNFT\\n        AppStorage storage s = appStorage();\\n        STypes.NFT storage nft = s.nftMapping[tokenId];\\n        if (nft.owner == address(0)) revert Errors.NotMinted();\\n        address asset = s.assetMapping[nft.assetId];\\n        STypes.ShortRecord storage short =\\n            s.shortRecords[asset][nft.owner][nft.shortRecordId];\\n// Add the line below\\n       emit Events.Transfer(nft.owner, address(0), tokenId);\\n        delete s.nftMapping[tokenId];\\n        delete s.getApproved[tokenId];\\n        delete short.tokenId;\\n// Remove the line below\\n       emit Events.Transfer(nft.owner, address(0), tokenId);\\n    }\\n```\\n
The `ERC721::Transfer` is an important event. The incorrect event logs may cause off-chain services to malfunction.
```\\n    function burnNFT(uint256 tokenId) internal {\\n        //@dev No need to check downcast tokenId because it is handled in function that calls burnNFT\\n        AppStorage storage s = appStorage();\\n      STypes.NFT storage nft = s.nftMapping[tokenId];\\n        if (nft.owner == address(0)) revert Errors.NotMinted();\\n        address asset = s.assetMapping[nft.assetId];\\n        STypes.ShortRecord storage short =\\n            s.shortRecords[asset][nft.owner][nft.shortRecordId];\\n      delete s.nftMapping[tokenId];\\n        delete s.getApproved[tokenId];\\n        delete short.tokenId;\\n      emit Events.Transfer(nft.owner, address(0), tokenId);\\n    }\\n```\\n