ECDSAMock.sol 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/cryptography/ECDSA.sol";
  4. contract ECDSAMock {
  5. using ECDSA for bytes32;
  6. using ECDSA for bytes;
  7. function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
  8. return hash.recover(signature);
  9. }
  10. // solhint-disable-next-line func-name-mixedcase
  11. function recover_v_r_s(
  12. bytes32 hash,
  13. uint8 v,
  14. bytes32 r,
  15. bytes32 s
  16. ) public pure returns (address) {
  17. return hash.recover(v, r, s);
  18. }
  19. // solhint-disable-next-line func-name-mixedcase
  20. function recover_r_vs(
  21. bytes32 hash,
  22. bytes32 r,
  23. bytes32 vs
  24. ) public pure returns (address) {
  25. return hash.recover(r, vs);
  26. }
  27. function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
  28. return hash.toEthSignedMessageHash();
  29. }
  30. function toEthSignedMessageHash(bytes memory s) public pure returns (bytes32) {
  31. return s.toEthSignedMessageHash();
  32. }
  33. }