Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect offer status check in `closeBidTaker` function could block bid taker operations and cause financial discrepancies

Summary

The DeliveryPlace contract contains a potential issue in the closeBidTaker function, which could affect the proper handling of bid taker operations. The issue involves an incorrect status check for the offer, which can result in unexpected behaviors and prevent the function from working as intended.

Vulnerability Details

In the closeBidTaker function, the comment suggests that the offer status should be Settled:

* @dev offer status must be Settled

However, the function includes a check for OfferStatus.Virgin:

function closeBidTaker(address _stock) external {
...
if (offerInfo.offerStatus == OfferStatus.Virgin) {
collateralFee = OfferLibraries.getDepositAmount(
offerInfo.offerType, offerInfo.collateralRate, offerInfo.amount, true, Math.Rounding.Floor
);
} else {
uint256 usedAmount = offerInfo.amount.mulDiv(offerInfo.usedPoints, offerInfo.points, Math.Rounding.Floor);
collateralFee = OfferLibraries.getDepositAmount(
offerInfo.offerType, offerInfo.collateralRate, usedAmount, true, Math.Rounding.Floor
);
}
...

Impact

The function expects the offer to be in the Settled state but incorrectly checks for Virgin, therefore this could lead to situations where bid takers cannot correctly close their positions or receive proper refunds. This might block the completion of bid-related operations and cause financial discrepancies or operational issues.

Tools Used

VSCode

Recommendations

Correct the status check in the closeBidTaker function to verify that the offer is in the Settled state, as intended:

- if (offerInfo.offerStatus == OfferStatus.Virgin) {
+ if (offerInfo.offerStatus == OfferStatus.Settled) {
revert InvalidOfferStatus();
}
Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[invalid] finding-PreMarkets-closeBidTaker-Virgin-Settled-unreachable

Borderline informational/low severity, taker bid offers can only be closed after settlement by original makers, so the check for `Settled` offer status is correct but the initial `if` block is dead code and will never be reached i.e., even if original maker offer was not settled, this issue cannot be exploited. Additionally, makers are incentivized to settle original offers to earn maker bonuses from subsequent trades from the original maker offers by takers. Some issues such as 612, 1774 and 1775 have no impact described but I am duplicating anyways since I am invalidating this issue. Assigning as informational severity since I believe this can be seen as simply a waste of gas and confusing code logic.

Support

FAQs

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