Platform: Code4rena
Start Date: 13/11/2023
Pot Size: $24,500 USDC
Total HM: 3
Participants: 120
Period: 4 days
Judge: 0xTheC0der
Id: 306
League: ETH
Rank: 71/120
Findings: 1
Award: $4.08
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: chaduke
Also found by: 0xpiken, Bauchibred, Matin, MohammedRizwan, MrPotatoMagic, OMEN, Pheonix, SandNallani, T1MOH, Topmark, ZanyBonzy, adriro, aslanbek, ayden, bareli, bart1e, bin2chen, btk, cheatc0d3, codynhat, critical-or-high, d3e4, erebus, firmanregar, hunter_w3b, jasonxiale, kaveyjoe, ksk2345, lsaudit, max10afternoon, merlinboii, nailkhalimov, osmanozdemir1, peanuts, pep7siup, pontifex, sbaudh6, shenwilly, sl1, tourist, wisdomn_, young, zhaojie
4.0797 USDC - $4.08
https://github.com/code-423n4/2023-11-canto/blob/main/1155tech-contracts/src/Market.sol#L290
In a _splitFees()
function, on line #290 makes multiply after values were divided. Solidity doesn't support floating numbers. It means every time when functions buy(), burnNFT() or sell is calling, then it calculate wrong value of fees, which sharing among holders.
On line #290 makes multiplying shareHolderFee * 1e18
.
The value of shareHolderFee
is calculated as uint256 shareHolderFee = (_fee * HOLDER_CUT_BPS) / 10_000
.
As a result, we have an expression: ((_fee * HOLDER_CUT_BPS) / 10_000) * 1e18
and it makes wrong calculation of fees.
My recommendation is to create value, which is making calculations and storing this value:
uint256 shareHolderFeeCorrect = (_fee * HOLDER_CUT_BPS * 1e18) / 10_000;
Math
#0 - c4-pre-sort
2023-11-18T09:32:00Z
minhquanym marked the issue as duplicate of #19
#1 - c4-judge
2023-11-29T17:45:36Z
MarioPoneder changed the severity to QA (Quality Assurance)
#2 - c4-judge
2023-11-29T22:41:34Z
MarioPoneder marked the issue as grade-b