add useful check for user to _processWithdraw

Signed-off-by: T-Hax <>
This commit is contained in:
T-Hax 2023-06-13 19:40:30 +00:00
parent 13dfec1fae
commit f5a302910a

@ -161,10 +161,17 @@ contract ERC20TornadoCloneable is ERC20Tornado {
uint256 _fee, uint256 _fee,
uint256 _refund uint256 _refund
) internal override { ) internal override {
// This is the part which we don't check if infra is down
if (router != address(0)) { if (router != address(0)) {
require(msg.sender == router, "if infrastructure not dead, router must be caller"); require(msg.sender == router, "if infrastructure not dead, router must be caller");
} }
// This check should make sure that a user doesn't doom his refund by chance
if (_relayer == address(0)) {
require(_fee == 0 && _refund == 0, "no fees and refunds if no relayer");
}
// Call the regular super version of the function
super._processWithdraw(_recipient, _relayer, _fee, _refund); super._processWithdraw(_recipient, _relayer, _fee, _refund);
} }
} }