forked from bokkypoobah/OpenANXTokenOld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOwned.sol
57 lines (47 loc) · 2.16 KB
/
Owned.sol
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
pragma solidity ^0.4.11;
// ----------------------------------------------------------------------------
// OAX 'openANX Token' crowdfunding contract - Owned contracts
//
// Refer to http://openanx.org/ for further information.
//
// Enjoy. (c) openANX and BokkyPooBah / Bok Consulting Pty Ltd 2017.
// The MIT Licence.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
// ------------------------------------------------------------------------
// Current owner, and proposed new owner
// ------------------------------------------------------------------------
address public owner;
address public newOwner;
// ------------------------------------------------------------------------
// Constructor - assign creator as the owner
// ------------------------------------------------------------------------
function Owned() {
owner = msg.sender;
}
// ------------------------------------------------------------------------
// Modifier to mark that a function can only be executed by the owner
// ------------------------------------------------------------------------
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
// ------------------------------------------------------------------------
// Owner can initiate transfer of contract to a new owner
// ------------------------------------------------------------------------
function transferOwnership(address _newOwner) onlyOwner {
newOwner = _newOwner;
}
// ------------------------------------------------------------------------
// New owner has to accept transfer of contract
// ------------------------------------------------------------------------
function acceptOwnership() {
if (msg.sender != newOwner) throw;
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}