ECDSAMock.sol 887 B

123456789101112131415161718192021222324252627282930313233343536
  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. function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
  7. return hash.recover(signature);
  8. }
  9. // solhint-disable-next-line func-name-mixedcase
  10. function recover_v_r_s(
  11. bytes32 hash,
  12. uint8 v,
  13. bytes32 r,
  14. bytes32 s
  15. ) public pure returns (address) {
  16. return hash.recover(v, r, s);
  17. }
  18. // solhint-disable-next-line func-name-mixedcase
  19. function recover_r_vs(
  20. bytes32 hash,
  21. bytes32 r,
  22. bytes32 vs
  23. ) public pure returns (address) {
  24. return hash.recover(r, vs);
  25. }
  26. function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
  27. return hash.toEthSignedMessageHash();
  28. }
  29. }