/
MockECDSA.sol
62 lines (51 loc) · 1.65 KB
/
MockECDSA.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol";
contract MockECDSA {
using ECDSA for bytes32;
function tryRecover(bytes32 hash, bytes memory signature) external pure returns (address, ECDSA.RecoverError) {
return hash.tryRecover(signature);
}
function recover(bytes32 hash, bytes memory signature) external pure returns (address) {
return hash.recover(signature);
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) external pure returns (address, ECDSA.RecoverError) {
return hash.tryRecover(r, vs);
}
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) external pure returns (address){
return hash.recover(r, vs);
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) external pure returns (address, ECDSA.RecoverError) {
return hash.tryRecover(v, r, s);
}
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) external pure returns (address){
return hash.recover(v, r, s);
}
function toEthSignedMessageHash(bytes32 hash) external pure returns (bytes32) {
return hash.toEthSignedMessageHash();
}
function toEthSignedMessageHash(bytes memory s) external pure returns (bytes32) {
return ECDSA.toEthSignedMessageHash(s);
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) external pure returns (bytes32) {
return domainSeparator.toTypedDataHash(structHash);
}
}