ETHMixer.sol 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // https://tornado.cash
  2. /*
  3. * d888888P dP a88888b. dP
  4. * 88 88 d8' `88 88
  5. * 88 .d8888b. 88d888b. 88d888b. .d8888b. .d888b88 .d8888b. 88 .d8888b. .d8888b. 88d888b.
  6. * 88 88' `88 88' `88 88' `88 88' `88 88' `88 88' `88 88 88' `88 Y8ooooo. 88' `88
  7. * 88 88. .88 88 88 88 88. .88 88. .88 88. .88 dP Y8. .88 88. .88 88 88 88
  8. * dP `88888P' dP dP dP `88888P8 `88888P8 `88888P' 88 Y88888P' `88888P8 `88888P' dP dP
  9. * ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
  10. */
  11. pragma solidity ^0.5.8;
  12. import "./Mixer.sol";
  13. contract ETHMixer is Mixer {
  14. constructor(
  15. address _verifier,
  16. uint256 _denomination,
  17. uint8 _merkleTreeHeight,
  18. uint256 _emptyElement,
  19. address payable _operator
  20. ) Mixer(_verifier, _denomination, _merkleTreeHeight, _emptyElement, _operator) public {
  21. }
  22. function _processWithdraw(address payable _receiver, address payable _relayer, uint256 _fee, uint256 _refund) internal {
  23. // sanity checks
  24. require(msg.value == 0, "Message value is supposed to be zero for ETH mixer");
  25. require(_refund == 0, "Refund value is supposed to be zero for ETH mixer");
  26. _receiver.transfer(denomination - _fee);
  27. if (_fee > 0) {
  28. _relayer.transfer(_fee);
  29. }
  30. }
  31. function _processDeposit() internal {
  32. require(msg.value == denomination, "Please send `mixDenomination` ETH along with transaction");
  33. }
  34. }