OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

Incorrect Balance Accounting for Deflationary / Fee-On-Transfer Tokens

Root + Impact

Description

`createSellOrder` records `_amountToSell` without verifying how many tokens the contract actually received.

IERC20(_tokenToSell).safeTransferFrom(msg.sender, address(this), _amountToSell);
// balance delta not checkedhttps://commonmark.org/help/
orders[orderId].amountToSell = _amountToSell;

Risk

Impact:

If `_tokenToSell` charges transfer fees or is deflationary, the contract’s balance will be smaller than `amountToSell`. Any later `buyOrder` attempting to transfer that recorded amount will revert forever, locking seller funds.

Proof of Concept

Recommended Mitigation

Record `actualAmountReceived = balanceAfter – balanceBefore` and store that instead, or explicitly forbid deflationary / fee-on-transfer tokens.

Updates

Lead Judging Commences

yeahchibyke Lead Judge
about 1 month ago
yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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