ECDSAMockUpgradeable.sol 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/cryptography/ECDSAUpgradeable.sol";
  4. import "../proxy/utils/Initializable.sol";
  5. contract ECDSAMockUpgradeable is Initializable {
  6. function __ECDSAMock_init() internal onlyInitializing {
  7. __ECDSAMock_init_unchained();
  8. }
  9. function __ECDSAMock_init_unchained() internal onlyInitializing {
  10. }
  11. using ECDSAUpgradeable for bytes32;
  12. using ECDSAUpgradeable for bytes;
  13. function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
  14. return hash.recover(signature);
  15. }
  16. // solhint-disable-next-line func-name-mixedcase
  17. function recover_v_r_s(
  18. bytes32 hash,
  19. uint8 v,
  20. bytes32 r,
  21. bytes32 s
  22. ) public pure returns (address) {
  23. return hash.recover(v, r, s);
  24. }
  25. // solhint-disable-next-line func-name-mixedcase
  26. function recover_r_vs(
  27. bytes32 hash,
  28. bytes32 r,
  29. bytes32 vs
  30. ) public pure returns (address) {
  31. return hash.recover(r, vs);
  32. }
  33. function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
  34. return hash.toEthSignedMessageHash();
  35. }
  36. function toEthSignedMessageHash(bytes memory s) public pure returns (bytes32) {
  37. return s.toEthSignedMessageHash();
  38. }
  39. uint256[50] private __gap;
  40. }