Skip to content

Commit 7e7abdd

Browse files
Only send dust if non-zero (#64)
Some ERC20 implementations (savax) complain if you transfer 0 value Signed-off-by: tactical_retreat <[email protected]>
1 parent 885843e commit 7e7abdd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contracts/EncryptedERC.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,10 @@ contract EncryptedERC is TokenTracker, EncryptedUserBalances, AuditorManager {
514514
// Convert tokens to encrypted tokens
515515
(dust, tokenId) = _convertFrom(to, amount, tokenAddress, amountPCT);
516516

517-
// Return dust to user
518-
SafeERC20.safeTransfer(token, to, dust);
517+
// Return dust to user, if any
518+
if (dust > 0) {
519+
SafeERC20.safeTransfer(token, to, dust);
520+
}
519521

520522
// Emit deposit event
521523
emit Deposit(to, amount, dust, tokenId);

0 commit comments

Comments
 (0)