0xSplits / splits-contracts

Core smart contracts of 0xSplits
GNU General Public License v3.0
158 stars 34 forks source link

Eth or ERC20 dust #4

Closed sesameJar closed 1 year ago

sesameJar commented 1 year ago

I have been exploring the code base and haven't been able to find any reference on how you guys handle the remaining dust, considering division is always a rounded floor in Solidity. It would be great if you could direct me to the part of the code that handles this issue or the business logic on how this is decided.

Thanks.

wminshew commented 1 year ago

hi @sesameJar -- the simple answer is we don't. The amount of funds lost to rounding down division is on the order of 0-numRecipients wei per distribution, whereas even the cheapest evm opcode is 2-3 gas which is then priced in gwei (10**9 wei) -- e.g. you'd actually burn significantly more money trying to track the last few wei. Our contracts are designed so these straggler wei don't mess up the system in any functional capacity

there is another kind of dust we reference in our docs, but it is not the same as what you are referring to in this q