-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathPausible.sol
More file actions
59 lines (50 loc) · 1.88 KB
/
Copy pathPausible.sol
File metadata and controls
59 lines (50 loc) · 1.88 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pragma solidity ^0.4.24;
import '../database/Database.sol';
import '../database/Events.sol';
// @title A contract which allows for the freezing of functionality within the platform.
// @dev only valid with a single owned ownership model
// @author Kyle Dewhurst, MyBit Foundation
contract Pausible {
Database public database;
Events public events;
// @notice constructor: initialize database instance
constructor(address _database, address _events)
public {
database = Database(_database);
events = Events(_events);
}
// @notice This will pause all critical activity for the supplied address
// @param: The address of the contract which is to be paused\
function pause(address _contract)
onlyOwner
public {
database.setBool(keccak256(abi.encodePacked("paused", _contract)), true);
events.transaction('Contract paused', msg.sender, address(this), 0, address(0));
//emit LogPaused(_contract, msg.sender);
}
// @notice This will unpause all critical activity for the supplied address
// @param: The address of the contract which is to be unpaused
function unpause(address _contract)
onlyOwner
public {
database.deleteBool(keccak256(abi.encodePacked("paused", _contract)));
events.transaction('Contract unpaused', msg.sender, address(this), 0, address(0));
//emit LogUnpaused(_contract, msg.sender);
}
// @notice platform owners can destroy contract here
function destroy()
onlyOwner
external {
events.transaction('Pausible destroyed', address(this), msg.sender, address(this).balance, address(0));
selfdestruct(msg.sender);
}
// @notice reverts if caller is not the owner
modifier onlyOwner() {
require(database.boolStorage(keccak256(abi.encodePacked("owner", msg.sender))));
_;
}
/*
event LogPaused(address indexed _contract, address _owner);
event LogUnpaused(address indexed _contract, address _owner);
*/
}