The createTaker
function in the PreMarktes
contract is responsible for allowing users to create a "taker" for an existing offer. The function ensures that the taker complies with the parameters and restrictions of the offer, such as the offer's status, the points to be utilized, and other financial constraints. However, there is a critical issue in the validation logic for the points, which could lead to erroneous behavior, such as accepting an invalid number of points for a taker.
The intention is to ensure that the total points requested by the taker (_points
) combined with the points already used in the offer (offerInfo.usedPoints
) does not exceed the total points available in the offer (offerInfo.points
). However, the current code uses the <
operator to check this condition. This comparison will fail to reject cases where the sum of _points
and offerInfo.usedPoints
equals offerInfo.points
, which is contrary to the intention stated in the comment that points must be greater.
See the following code:
This issue allows the function to accept cases where all remaining points in the offer are consumed by the taker, which may not be the intended behavior, especially if the platform's logic requires some points to remain. This could lead to unexpected behavior in the marketplace, potentially disrupting the matching process or causing issues with the offer lifecycle.
Manual Review
The comparison should be adjusted to use the <=
operator instead of <
, ensuring that the function rejects cases where _points + offerInfo.usedPoints
equals or exceeds offerInfo.points
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.