mirror of
https://github.com/tornadocash/tornado-anonymity-mining.git
synced 2024-11-22 01:37:08 +01:00
Fix CVF-55, CVF-54
This commit is contained in:
parent
97b486b9ba
commit
6850d6a6c4
@ -106,19 +106,19 @@ contract TornadoProxy {
|
||||
function rescueTokens(
|
||||
IERC20 _token,
|
||||
address payable _to,
|
||||
uint256 _balance
|
||||
uint256 _amount
|
||||
) external onlyGovernance {
|
||||
require(_to != address(0), "TORN: can not send to zero address");
|
||||
|
||||
if (_token == IERC20(0)) {
|
||||
// for Ether
|
||||
uint256 totalBalance = address(this).balance;
|
||||
uint256 balance = _balance == 0 ? totalBalance : Math.min(totalBalance, _balance);
|
||||
uint256 balance = Math.min(totalBalance, _amount);
|
||||
_to.transfer(balance);
|
||||
} else {
|
||||
// any other erc20
|
||||
uint256 totalBalance = _token.balanceOf(address(this));
|
||||
uint256 balance = _balance == 0 ? totalBalance : Math.min(totalBalance, _balance);
|
||||
uint256 balance = Math.min(totalBalance, _amount);
|
||||
require(balance > 0, "TORN: trying to send 0 balance");
|
||||
_token.safeTransfer(_to, balance);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user