From fb7dd53112ae4e3ba47fedeeae4abcf1a9669e9d Mon Sep 17 00:00:00 2001 From: poma Date: Wed, 16 Jun 2021 02:49:38 +0300 Subject: [PATCH] add solidity asserts --- contracts/TornadoPool.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/TornadoPool.sol b/contracts/TornadoPool.sol index 22d5ba9..b759789 100644 --- a/contracts/TornadoPool.sol +++ b/contracts/TornadoPool.sol @@ -121,9 +121,12 @@ contract TornadoPool is ReentrancyGuard { int256 extAmount = calculateExternalAmount(_extAmount); if (extAmount > 0) { require(msg.value == uint256(extAmount), "Incorrect amount of ETH sent on deposit"); - } else { + } else if (extAmount < 0) { require(msg.value == 0, "Sent ETH amount should be 0 for withdrawal"); + require(_extData.recipient != address(0), "Can't withdraw to zero address"); _extData.recipient.transfer(uint256(-extAmount)); + } else { + require(msg.value == 0, "Sent ETH amount should be 0 for transaction"); } if (_fee > 0) {