Market.sol#L280-L296
In this case, a user can front-run these transactions with a buy() to buy a share so that shareData[_id].tokensInCirculation > 0 and therefore, effectively be able to steal all such shareHolderFee in these situations.
Mitigation: Implement a snapshot mechanism for market so that a user can not just suddenly buy shares and enjoy rewards immediately. See ERC20Snapshot for an example:
ERC20Snapshot
0xTheC0der (judge) commented:
For this audit, 17 reports were submitted by wardens detailing gas optimizations. The report highlighted below by 0xVolcano received the top score from the judge.
The following wardens also submitted reports: sivanesh_808, hunter_w3b, mgf15, tala7985, cheatc0d3, JCK, 0xAnah, lsaudit, MrPotatoMagic, K42, 0xhex, 0xta, tabriz, chaduke, 100su, and parlayan_yildizlar_takimi.
Note: The following findings were not found by the bot. For max savings, please implement the changes found by bot.
