forked from pacta-app/vote-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsigned.sol
More file actions
45 lines (39 loc) · 974 Bytes
/
Copy pathsigned.sol
File metadata and controls
45 lines (39 loc) · 974 Bytes
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
pragma solidity >=0.0;
import "./libsign.sol";
contract signed {
address public signatory;
// signatory has signed message
modifier issigned(
bytes memory secret,
uint8 v,
bytes32 r,
bytes32 s
) {
verified(secret, v, r, s);
_;
}
constructor(address _signatory) internal {
signatory = _signatory;
}
function verify(
bytes memory secret,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address sender) {
sender = libsign.verify(secret, v, r, s);
}
// signatory has signed message
function verified(
bytes memory secret,
uint8 v,
bytes32 r,
bytes32 s
) internal view returns (address sender) {
sender = libsign.verify(secret, v, r, s);
require(
sender == signatory,
"access denied, you are not the signatory of this contract"
);
}
}