Spicy Nylon Cormorant
Medium
Some ERC20 tokens do not revert on failure but instead, return false if their transfer/transferFrom functions fail. In the case that a payment token returns false on failure, users may be able to add reviews without transferring tokens.
In _handlePayment
transferFrom
is used to receive payment tokens:
IERC20(paymentToken).transferFrom(msg.sender, address(this), price);
- There is a mandatory payment fee when adding reviews
No response
- A token that does not revert on failure is added as a payment token.
- User adds a review using that token but their transfer fails.
- Even though they didn't transfer the token they successfully added the review, avoiding the necessary payment.
Users may be able to add reviews for free.
No response
Consider using Openzeppelin's SafeERC20 to transfer ERC20 tokens.