mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-08-08 14:52:15 -04:00
return refund to a relayer in case of failure
This commit is contained in:
parent
a6519fb280
commit
ce550eea58
3 changed files with 96 additions and 2 deletions
|
@ -38,8 +38,13 @@ contract ERC20Mixer is Mixer {
|
|||
if (_fee > 0) {
|
||||
_safeErc20Transfer(_relayer, _fee);
|
||||
}
|
||||
|
||||
if (_refund > 0) {
|
||||
_recipient.call.value(_refund)("");
|
||||
(bool success, ) = _recipient.call.value(_refund)("");
|
||||
if (!success) {
|
||||
// let's return _refund back to the relayer
|
||||
_relayer.transfer(_refund);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
7
contracts/Mocks/BadRecipient.sol
Normal file
7
contracts/Mocks/BadRecipient.sol
Normal file
|
@ -0,0 +1,7 @@
|
|||
pragma solidity ^0.5.0;
|
||||
|
||||
contract BadRecipient {
|
||||
function() external {
|
||||
require(false, "this contract does not accept ETH");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue