add solidity asserts

This commit is contained in:
poma 2021-06-16 02:49:38 +03:00
parent 4c05f4e2fe
commit fb7dd53112
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657

View File

@ -121,9 +121,12 @@ contract TornadoPool is ReentrancyGuard {
int256 extAmount = calculateExternalAmount(_extAmount); int256 extAmount = calculateExternalAmount(_extAmount);
if (extAmount > 0) { if (extAmount > 0) {
require(msg.value == uint256(extAmount), "Incorrect amount of ETH sent on deposit"); 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(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)); _extData.recipient.transfer(uint256(-extAmount));
} else {
require(msg.value == 0, "Sent ETH amount should be 0 for transaction");
} }
if (_fee > 0) { if (_fee > 0) {