The Distribute::distribute function will return early in case an EIP-20 distribution occurs that is 0, however, the same does not apply to native fund distributions.
Impact:
The Distribute::distribute function will inefficiently perform multiple statements when a zero-value native fund distribution occurs.
We advise the if (amount == 0) return; statement to be relocated after the initial if-else block, ensuring that all potential distributions of 0 return early.
I decided to add a check in the else statement instead to prevent a useless transfer of 0 amount, that could potentially fail in some erc20 implementations anyway
DET-03C: Inexistent Prevention of Zero Native Fund Distribution
Description:
The
Distribute::distribute
function will return early in case an EIP-20 distribution occurs that is0
, however, the same does not apply to native fund distributions.Impact:
The
Distribute::distribute
function will inefficiently perform multiple statements when a zero-value native fund distribution occurs.Example:
Recommendation:
We advise the
if (amount == 0) return;
statement to be relocated after the initialif-else
block, ensuring that all potential distributions of0
return early.