|
| 1 | +pragma solidity ^0.4.19; |
| 2 | + |
| 3 | + |
| 4 | +/** |
| 5 | + * @title Ownable |
| 6 | + * @dev The Ownable contract has an owner address, and provides basic authorization control |
| 7 | + * functions, this simplifies the implementation of “user permissions”. |
| 8 | + */ |
| 9 | + |
| 10 | +contract Ownable { |
| 11 | + address public owner; |
| 12 | + |
| 13 | + |
| 14 | + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); |
| 15 | + |
| 16 | + /** |
| 17 | + * @dev The Ownable constructor sets the original `owner` of the contract to the sender |
| 18 | + * account. |
| 19 | + */ |
| 20 | + function Ownable() { |
| 21 | + owner = msg.sender; |
| 22 | + } |
| 23 | + |
| 24 | + |
| 25 | + /** |
| 26 | + * @dev Throws if called by any account other than the owner. |
| 27 | + */ |
| 28 | + modifier onlyOwner() { |
| 29 | + require(msg.sender == owner); |
| 30 | + _; |
| 31 | + } |
| 32 | + |
| 33 | + |
| 34 | + /** |
| 35 | + * @dev Allows the current owner to transfer control of the contract to a newOwner. |
| 36 | + * @param newOwner The address to transfer ownership to. |
| 37 | + */ |
| 38 | + function transferOwnership(address newOwner) onlyOwner public { |
| 39 | + require(newOwner != address(0)); |
| 40 | + OwnershipTransferred(owner, newOwner); |
| 41 | + owner = newOwner; |
| 42 | + } |
| 43 | + |
| 44 | +} |
| 45 | + |
| 46 | +/** |
| 47 | + * @title Pausable |
| 48 | + * @dev Base contract which allows children to implement an emergency stop mechanism. |
| 49 | + */ |
| 50 | + |
| 51 | +contract Pausable is Ownable { |
| 52 | + event Pause(); |
| 53 | + event Unpause(); |
| 54 | + |
| 55 | + bool public paused = false; |
| 56 | + |
| 57 | + |
| 58 | + /** |
| 59 | + * @dev Modifier to make a function callable only when the contract is not paused. |
| 60 | + */ |
| 61 | + modifier whenNotPaused() { |
| 62 | + require(!paused); |
| 63 | + _; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * @dev Modifier to make a function callable only when the contract is paused. |
| 68 | + */ |
| 69 | + modifier whenPaused() { |
| 70 | + require(paused); |
| 71 | + _; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * @dev called by the owner to pause, triggers stopped state |
| 76 | + */ |
| 77 | + function pause() onlyOwner whenNotPaused public { |
| 78 | + paused = true; |
| 79 | + Pause(); |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * @dev called by the owner to unpause, returns to normal state |
| 84 | + */ |
| 85 | + function unpause() onlyOwner whenPaused public { |
| 86 | + paused = false; |
| 87 | + Unpause(); |
| 88 | + } |
| 89 | +} |
| 90 | + |
| 91 | +contract Attestation is Ownable,Pausable { |
| 92 | + |
| 93 | + event Attest(address indexed _from, string indexed _type); |
| 94 | + |
| 95 | + function Attestation(){ |
| 96 | + |
| 97 | + } |
| 98 | + |
| 99 | + function save(string _event_type,string _data) whenNotPaused { |
| 100 | + Attest(msg.sender,_event_type); |
| 101 | + } |
| 102 | + |
| 103 | + /* |
| 104 | + function to kill contract |
| 105 | + */ |
| 106 | + |
| 107 | + function kill() onlyOwner { |
| 108 | + selfdestruct(owner); |
| 109 | + } |
| 110 | +} |
0 commit comments