TornadoProxyLight.sol 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.6.0;
  3. pragma experimental ABIEncoderV2;
  4. import "./interfaces/ITornadoInstance.sol";
  5. contract TornadoProxyLight {
  6. event EncryptedNote(address indexed sender, bytes encryptedNote);
  7. function deposit(
  8. ITornadoInstance _tornado,
  9. bytes32 _commitment,
  10. bytes calldata _encryptedNote
  11. ) external payable {
  12. _tornado.deposit{ value: msg.value }(_commitment);
  13. emit EncryptedNote(msg.sender, _encryptedNote);
  14. }
  15. function withdraw(
  16. ITornadoInstance _tornado,
  17. bytes calldata _proof,
  18. bytes32 _root,
  19. bytes32 _nullifierHash,
  20. address payable _recipient,
  21. address payable _relayer,
  22. uint256 _fee,
  23. uint256 _refund
  24. ) external payable {
  25. _tornado.withdraw{ value: msg.value }(_proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund);
  26. }
  27. function backupNotes(bytes[] calldata _encryptedNotes) external {
  28. for (uint256 i = 0; i < _encryptedNotes.length; i++) {
  29. emit EncryptedNote(msg.sender, _encryptedNotes[i]);
  30. }
  31. }
  32. }