-
Notifications
You must be signed in to change notification settings - Fork 1
/
contract-conf.sol
40 lines (35 loc) · 997 Bytes
/
contract-conf.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
pragma solidity >=0.4.25 <0.6.0;
contract HelloBlockchain {
//Set of States
enum StateType { Request, Respond}
//List of properties
StateType public State;
address public Requestor;
address public Responder;
string public RequestMessage;
string public ResponseMessage;
// constructor function
constructor(string memory message) public
{
Requestor = msg.sender;
RequestMessage = message;
State = StateType.Request;
}
// call this function to send a request
function SendRequest(string memory requestMessage) public
{
if (Requestor != msg.sender)
{
revert();
}
RequestMessage = requestMessage;
State = StateType.Request;
}
// call this function to send a response
function SendResponse(string memory responseMessage) public
{
Responder = msg.sender;
ResponseMessage = responseMessage;
State = StateType.Respond;
}
}