From f0ed649db3cc64d61125f4b7b84af5a1e7a3dada Mon Sep 17 00:00:00 2001 From: Arseniy Klempner Date: Tue, 25 Oct 2016 10:15:37 -0700 Subject: [PATCH] Add release method to Stoppable. Create StoppableMock --- contracts/Stoppable.sol | 7 ++++++- contracts/test-helpers/StoppableMock.sol | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 contracts/test-helpers/StoppableMock.sol diff --git a/contracts/Stoppable.sol b/contracts/Stoppable.sol index d649ce019..99ad5ad3b 100644 --- a/contracts/Stoppable.sol +++ b/contracts/Stoppable.sol @@ -2,7 +2,7 @@ pragma solidity ^0.4.0; /* * Stoppable * Abstract contract that allows children to implement an - * emergency stop mechanism. + * emergency stop mechanism. */ contract Stoppable { address public curator; @@ -21,4 +21,9 @@ contract Stoppable { stopped = true; } + function release() external onlyInEmergency { + if (msg.sender != curator) throw; + stopped = false; + } + } diff --git a/contracts/test-helpers/StoppableMock.sol b/contracts/test-helpers/StoppableMock.sol new file mode 100644 index 000000000..9cbd8a562 --- /dev/null +++ b/contracts/test-helpers/StoppableMock.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.4.0; +import '../Stoppable.sol'; + +// mock class using Stoppable +contract StoppableMock is Stoppable { + bool public drasticMeasureTaken; + uint public count = 0; + + function normalProcess() external stopInEmergency { + count++; + } + + function drasticMeasure() external onlyInEmergency { + drasticMeasureTaken = true; + } + +}