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