Prevent zero value transfers to eliminate one of the reasons that could make _distribute
fail and waste a decent amount of gas (because the transfers happen in a loop).
Given that the plan is to deploy the protocol on any EVM compatible there is an easy check that could be implemented in order to avoid an edge case revert in the _distribute
function transfer loop. Although EIP-20 specifies the acceptance of zero-valued transfers, certain tokens like BNB (!!!) may trigger a revert when such transfers are attempted. This behavior could lead to the complete reverting of transactions, and depending on how big the winners array is this could be gas intensive. To mitigate this, consider skipping the transfer for zero amounts.
BNB transfer function:
Wasted gas
Manual review
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.