sherlock-audit / 2024-09-predict-fun-judging

0 stars 0 forks source link

Melodic Mocha Aardvark - The transaction will fail if the transfer of collateral is not already approved #336

Closed sherlock-admin2 closed 2 days ago

sherlock-admin2 commented 2 days ago

Melodic Mocha Aardvark

Low/Info

The transaction will fail if the transfer of collateral is not already approved

Summary

The contract doesn't explicitly check if the borrower has approved the transfer. If the borrower hasn't approved, the transaction will revert, but it will do so after consuming gas for all prior operations.

CTF.safeTransferFrom(borrower, address(this), positionId, collateralAmountRequired, "");

The borrower must have sufficient collateral and have approved the transfer before calling this function. This might be challenging for some users who prefer to separate approval and transfer actions.

Root Cause

https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L991

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

PoC

No response

Mitigation

No response