Chris Segura 2019-10-29 20:02:38 -07:00
Родитель 15863b54cf 3c54b5b54f
Коммит a40021cf4f
1 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -6,8 +6,7 @@ contract Base {
address public Responder; address public Responder;
} }
contract HelloBlockchain is Base contract HelloBlockchain is Base {
{
enum StateType { Request, Respond } enum StateType { Request, Respond }
enum SwitcherEnum { On, Off } enum SwitcherEnum { On, Off }
@ -16,23 +15,19 @@ contract HelloBlockchain is Base
string public RequestMessage; string public RequestMessage;
string public ResponseMessage; string public ResponseMessage;
constructor(string memory message) public constructor(string memory message) public {
{
Requestor = msg.sender; Requestor = msg.sender;
RequestMessage = message; RequestMessage = message;
State = StateType.Request; State = StateType.Request;
} }
function SendRequest(string memory requestMessage, StateType state) public function SendRequest(string memory requestMessage, StateType state) public {
{
RequestMessage = requestMessage; RequestMessage = requestMessage;
State = state; State = state;
} }
function SendResponse(StateType state, SwitcherEnum flag) public function SendResponse(StateType state, SwitcherEnum flag) public {
{ if (flag == SwitcherEnum.On) {
if (flag == SwitcherEnum.On)
{
Responder = msg.sender; Responder = msg.sender;
} }
@ -40,8 +35,7 @@ contract HelloBlockchain is Base
} }
function SwitcheToOff(uint completed) public { function SwitcheToOff(uint completed) public {
if(completed > 0) if(completed > 0) {
{
Flag = SwitcherEnum.Off; Flag = SwitcherEnum.Off;
} }
} }