ECDSAMock.sol 980 B

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