aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/zeppelin/lifecycle/Pausable.sol
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-07-05 18:28:15 +0800
committerchriseth <chris@ethereum.org>2017-07-05 18:39:55 +0800
commitac84b36144f746662e5ddb984d283e053c7d06ba (patch)
treef50ee438a384e60574a4c28ea32d2b6ae2315795 /test/compilationTests/zeppelin/lifecycle/Pausable.sol
parent05a26fc98c1201057c618c536ca0537e456c9b15 (diff)
downloaddexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.gz
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.bz2
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.lz
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.xz
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.tar.zst
dexon-solidity-ac84b36144f746662e5ddb984d283e053c7d06ba.zip
Added various contracts for testing.
Diffstat (limited to 'test/compilationTests/zeppelin/lifecycle/Pausable.sol')
-rw-r--r--test/compilationTests/zeppelin/lifecycle/Pausable.sol51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/compilationTests/zeppelin/lifecycle/Pausable.sol b/test/compilationTests/zeppelin/lifecycle/Pausable.sol
new file mode 100644
index 00000000..b14f8767
--- /dev/null
+++ b/test/compilationTests/zeppelin/lifecycle/Pausable.sol
@@ -0,0 +1,51 @@
+pragma solidity ^0.4.11;
+
+
+import "../ownership/Ownable.sol";
+
+
+/**
+ * @title Pausable
+ * @dev Base contract which allows children to implement an emergency stop mechanism.
+ */
+contract Pausable is Ownable {
+ event Pause();
+ event Unpause();
+
+ bool public paused = false;
+
+
+ /**
+ * @dev modifier to allow actions only when the contract IS paused
+ */
+ modifier whenNotPaused() {
+ if (paused) throw;
+ _;
+ }
+
+ /**
+ * @dev modifier to allow actions only when the contract IS NOT paused
+ */
+ modifier whenPaused {
+ if (!paused) throw;
+ _;
+ }
+
+ /**
+ * @dev called by the owner to pause, triggers stopped state
+ */
+ function pause() onlyOwner whenNotPaused returns (bool) {
+ paused = true;
+ Pause();
+ return true;
+ }
+
+ /**
+ * @dev called by the owner to unpause, returns to normal state
+ */
+ function unpause() onlyOwner whenPaused returns (bool) {
+ paused = false;
+ Unpause();
+ return true;
+ }
+}