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: 11/37
Findings: 2
Award: $73.58
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xSmartContract
Also found by: Deivitto, Josiah, RaymondFam, aphak5010, cccz, cryptonue, gzeon, joestakey, keccak123, martin, peritoflores, rotcivegaf
370.8153 CANTO - $59.89
According to README
Users are lazily allocated fees. This means that each user withdraws all fees they have accrued since the last time they have withdrawn from a NFT.
Instead of all
fees, the withdraw function allow the user to specify the _amount
to withdraw.
function withdraw(uint256 _tokenId, address payable _recipient, uint256 _amount) public onlyNftOwner(_tokenId) returns (uint256) { uint256 earnedFees = balances[_tokenId]; if (earnedFees == 0 || _amount == 0) revert NothingToWithdraw(); if (_amount > earnedFees) _amount = earnedFees; balances[_tokenId] = earnedFees - _amount; emit Withdraw(_tokenId, _recipient, _amount); Address.sendValue(_recipient, _amount); return _amount; }
It doesn't seems to do any harm if this function is permissionless, then the contract don't even need Ownable
function distributeFees(uint256 _tokenId) public onlyOwner payable {
Add indexed fields for easier analytics
event Register(address smartContract, address recipient, uint256 tokenId); event Assign(address smartContract, uint256 tokenId); event Withdraw(uint256 tokenId, address recipient, uint256 feeAmount); event DistributeFees(uint256 tokenId, uint256 feeAmount);
#0 - c4-judge
2023-01-02T13:03:58Z
berndartmueller marked the issue as grade-b
🌟 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
Variable can be tightly packed into 1 slot without sacrificing usability
struct NftData { uint248 tokenId; bool registered; }
It seems to be always be true when tokenId is set and therefore can be removed.
#0 - c4-judge
2022-11-29T19:17:51Z
berndartmueller marked the issue as grade-b