The MartenitsaMarketplace::buyMartenitsa function uses the safeTransferFrom function to transfer the martenitsaToken from the seller to the buyer. If the buyer contract does not implement the onERC721Received function, the safeTransferFrom function will revert, preventing the buyer from purchasing the martenitsaToken.
If the buyer contract does not implement the onERC721Received function, the safeTransferFrom function will revert, preventing the buyer from purchasing the martenitsaToken. This can lead to a poor user experience and may result in failed transactions.
Proof of Concept:
A buyer contract is created without implementing the onERC721Received function.
The buyer contract attempts to purchase a martenitsaToken from the marketplace.
The safeTransferFrom function reverts due to the lack of onERC721Received implementation in the buyer contract.
The transaction fails, and the buyer is unable to purchase the martenitsaToken.
Here is the contract as well
Here is the foundry output
Ensure that the buyer contract implements the onERC721Received function as required by the ERC-721 standard. This function is called by the ERC-721 token contract after a successful transfer of a token to the buyer contract.
If the buyer contract does not implement the onERC721Received function, consider using the transferFrom function instead of safeTransferFrom to transfer the token. The transferFrom function does not require the buyer contract to implement the onERC721Received function and will not revert if the function is missing.
Provide clear documentation and guidance to users on the requirements for buying tokens from the marketplace, including the need to implement the onERC721Received function in the buyer contract.
Consider implementing checks in the MartenitsaMarketplace contract to detect whether the buyer contract implements the onERC721Received function and provide appropriate feedback to the user if the function is missing.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.