ECDSAMockUpgradeable.sol 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. }
  8. function __ECDSAMock_init_unchained() internal onlyInitializing {
  9. }
  10. using ECDSAUpgradeable for bytes32;
  11. using ECDSAUpgradeable for bytes;
  12. function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
  13. return hash.recover(signature);
  14. }
  15. // solhint-disable-next-line func-name-mixedcase
  16. function recover_v_r_s(
  17. bytes32 hash,
  18. uint8 v,
  19. bytes32 r,
  20. bytes32 s
  21. ) public pure returns (address) {
  22. return hash.recover(v, r, s);
  23. }
  24. // solhint-disable-next-line func-name-mixedcase
  25. function recover_r_vs(
  26. bytes32 hash,
  27. bytes32 r,
  28. bytes32 vs
  29. ) public pure returns (address) {
  30. return hash.recover(r, vs);
  31. }
  32. function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
  33. return hash.toEthSignedMessageHash();
  34. }
  35. function toEthSignedMessageHash(bytes memory s) public pure returns (bytes32) {
  36. return s.toEthSignedMessageHash();
  37. }
  38. /**
  39. * @dev This empty reserved space is put in place to allow future versions to add new
  40. * variables without shifting down storage in the inheritance chain.
  41. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  42. */
  43. uint256[50] private __gap;
  44. }