DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: low
Valid

`onERC721Received()` callback is never called when new tokens are minted in Erc721Facet.sol

Summary

The ERC721Facet contract does not properly call the corresponding callback when new tokens are minted.
The ERC721 standard states that the onERC721Received callback must be called when a mint or transfer operation occurs. However, the smart contracts interacting as users with Erc721Facet.mintNFT() will not be notified with the onERC721Received callback, as expected according to the ERC721 standard.

Vulnerability Details

onErc721Received() isn't called on minting:

function mintNFT(address asset, uint8 shortRecordId)
external
isNotFrozen(asset)
nonReentrant
onlyValidShortRecord(asset, msg.sender, shortRecordId)
{
if (shortRecordId == Constants.SHORT_MAX_ID) {
revert Errors.CannotMintLastShortRecord();
}
STypes.ShortRecord storage short =
s.shortRecords[asset][msg.sender][shortRecordId];
if (short.tokenId != 0) revert Errors.AlreadyMinted();
s.nftMapping[s.tokenIdCounter] = STypes.NFT({
owner: msg.sender,
assetId: s.asset[asset].assetId,
shortRecordId: shortRecordId
});
short.tokenId = s.tokenIdCounter;
//@dev never decreases
s.tokenIdCounter += 1;
}

Impact

It can create interoperability issues with users' contracts

Tools Used

Manual Review

Recommendations

Call onErc721Received()

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-114

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.