Platform: Code4rena
Start Date: 23/11/2022
Pot Size: $24,500 CANTO
Total HM: 5
Participants: 37
Period: 5 days
Judge: berndartmueller
Total Solo HM: 2
Id: 185
League: ETH
Rank: 33/37
Findings: 1
Award: $13.69
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Tricko
Also found by: 0xhacksmithh, AkshaySrivastav, Awesome, Beepidibop, Deivitto, DijkstraDev, Dinesh11G, Englave, JC, Rahoz, RaymondFam, ReyAdmirado, SaeedAlipoor01988, Sathish9098, abiih, aphak5010, chaduke, chrisdior4, exolorkistis, gzeon, martin, nicobevi, oyc_109, peritoflores, rotcivegaf
84.7394 CANTO - $13.69
Register function:
Counter
library by the use of a private variable of type uint256 see code.
Replace variable smartContract
with direct use of msg.value L50, L69, L95, L97, L112 and L114
Assign:
_exist(_tokenId)
with if(_tokenId >= _tokenIdTracker)
. The use that is given is only to know if the token is valid. It would fail in the event that the NFT was burned, although it is unlikely that the owner would do so of their own free will and in the event that it does, it would not cause any serious problems. The use of _exist(_tokenID)
in the distributeFees
function would be more useful see code
Withdraw:
If
statements. This way if the earnedFee
variable is zero, any value of _amount
will be updated to zero. With this, we can simplify the now second If
statement, which would look like this: if (_amount == 0) revert NothingToWithdraw()
see code
Address.sendValue(...)
with _recipient.call{value: _amount}("")
. Balance will always be limited to balance[_tokenId]
see code.
Total (applying all the above points):
#0 - c4-judge
2022-11-29T19:17:23Z
berndartmueller marked the issue as grade-b