1) The onlyNftOwner
modifier checks if the msg.sender of a transaction is the owner of the NFT tokenId that is to be swapped for erc20 tokens. in TokenDivider::divideNft
the modifier is redundant.
The onlyNftOwner
modifier will execute twice, checking twice that msg.sender is the owner of the NFT.
If the check passes the first time, it will also pass the second time (unless the NFT ownership changes between the two checks, which is unlikely).
The function will consume more gas than necessary due to the redundant modifier execution.
2) The TokenDivider::transferErcTokens
function is used to exchange the erc20 tokens between users which were swapped for a NFT . It does some validation checks first before transferring and updating the balances
state variable that stores the balance of an users erc20 holdings with respect to the token address.
The null address check validation for the receivers address is repeated twice, which is again unnecessary as it doesn't change the intended code logic being carried out. It just results in an extra redundant check costing up more gas.
Manual Review
Remove the redundancy
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.