The `onlyNftOwner` modifier is redundant in the divideNft function where it was applied twice.
Same as the check for `address(0)` in the `transferErcTokens` function
```solidity
if (to == address(0)) {
revert TokenDivider__CantTransferToAddressZero();
}`
```
Vulnerability Details
Impact
1. Code Clarity: Removing or using unused code improves readability and maintainability of the contract.
2. Gas Optimization: While the impact on gas might be minimal for a single unused error, maintaining a clean codebase can help in reducing the overall bytecode size, potentially saving gas costs in deployment or interactions.
3. Future Proofing: Keeping the code free from unused elements helps in understanding the contract's behavior more clearly, which is crucial for audits, upgrades, or when new developers join the project.
Tools Used
Manual Review
Recommendations
Remove the duplicate modifier and the dupilicate check to reduce gas costs and improve readability.