Submitted by joestakey, also found by Aymen0909, d3e4, Jeiwan, joestakey, and Trust
PA1D.sol#L391
PA1D.sol#L395
Payout recipients can call getEthPayout() to transfer the ETH balance of the contract to all payout recipients.
This function makes an internal call to _payoutEth, which sends the payment to the recipients based on their associated bp.
The issue is that the balance used in the transfer calls is not the contract ETH balance, but the balance minus a gasCost.
This means getEthPayout() calls will leave dust in the contract.
If the dust is small enough, a subsequent call to getEthPayout is likely to revert because of this check.
And enforcer/PA1D does not have any other ETH withdrawal function. While enforcer/PA1D is meant to be used via delegate calls from a NFT collection contract, if the NFT contract does not have any withdrawal function either, this dust mentioned above is effectively lost.
Let us take the example of a payout recipient trying to retrieve their share of the balance, equal to 40_000 For simplicity, assume one payout address, owned by Alice:
Alice has to wait for the balance to increase to call getEthPayout() again. But no matter what, there will always be at least a dust of 10000 left in the contract.
The transfers should be done based on address(this).balance. The gasCost is redundant as the gas amount is specified by the caller of getEthPayout(), the contract does not have to provide gas.
gzeon (judge) commented:
Trust (warden) commented:
gzeon (judge) commented:
alexanderattar (Holograph) confirmed and commented:
alexanderattar (Holograph) linked a PR:
