Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: medium
Invalid

Incorrect Ether Amount Validation in buyOrder Function

Summary

In the buyOrder function, the Ether amount validation checks if the buyer sends order.price + sellerFee as part of the payment. However, the buyer should only send order.price, as the seller fee is deducted internally from the price and the fee is deducted from it before transferring the Ether to the seller. This incorrect validation will cause the transaction to revert unnecessarily.

Vulnerability Details

if (msg.value < order.price + sellerFee) {
revert TokenDivider__InsuficientEtherForFees();
}

Wrong check for order price.

Impact

Buyers attempting to purchase tokens will have their transactions reverted even if they send the correct order.price amount.

Tools Used

Manual Review

Recommendations

if (msg.value < order.price) {
revert TokenDivider__IncorrectEtherAmount();
}
Updates

Lead Judging Commences

fishy Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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