mirror of
https://github.com/tornadocash/tornado-anonymity-mining.git
synced 2024-10-31 23:55:20 +01:00
_updateInstance updates
This commit is contained in:
parent
44e9d7d645
commit
b9570ea3c3
@ -90,7 +90,6 @@ contract TornadoProxy {
|
|||||||
|
|
||||||
function updateInstance(Tornado calldata _tornado) external onlyGovernance {
|
function updateInstance(Tornado calldata _tornado) external onlyGovernance {
|
||||||
_updateInstance(_tornado);
|
_updateInstance(_tornado);
|
||||||
emit InstanceStateUpdate(_tornado.addr, _tornado.instance.state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTornadoTreesContract(address _tornadoTrees) external onlyGovernance {
|
function setTornadoTreesContract(address _tornadoTrees) external onlyGovernance {
|
||||||
@ -124,7 +123,14 @@ contract TornadoProxy {
|
|||||||
if (_tornado.instance.isERC20) {
|
if (_tornado.instance.isERC20) {
|
||||||
IERC20 token = IERC20(_tornado.addr.token());
|
IERC20 token = IERC20(_tornado.addr.token());
|
||||||
require(token == _tornado.instance.token, "Incorrect token");
|
require(token == _tornado.instance.token, "Incorrect token");
|
||||||
|
uint256 allowance = token.allowance(address(this), address(_tornado.addr));
|
||||||
|
|
||||||
|
if (_tornado.instance.state != InstanceState.Disabled && allowance == 0) {
|
||||||
token.safeApprove(address(_tornado.addr), uint256(-1));
|
token.safeApprove(address(_tornado.addr), uint256(-1));
|
||||||
|
} else if (_tornado.instance.state == InstanceState.Disabled && allowance != 0) {
|
||||||
|
token.safeApprove(address(_tornado.addr), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit InstanceStateUpdate(_tornado.addr, _tornado.instance.state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user