Owned¶
Description¶
Allows inheriting contracts to have an owner and provides the onlyOwner
modifier, which restricts function access to that owner.
The owner can be changed by a nomination process, where the nominated owner must accept ownership before it is switched.
Source: Owned.sol
Architecture¶
Inheritance Graph¶
Variables¶
owner
¶
The contract owner.
Type: address public
nominatedOwner
¶
The currently-nominated owner.
Type: address public
Functions¶
constructor
¶
Initialises the owner of this contract.
Details
Signature
constructor(address _owner) public
Preconditions
- The initial owner cannot be the zero address.
Emits
nominateNewOwner
¶
Nominates a new owner of this contract, who may then call acceptOwnership
to become the owner.
Details
Signature
nominateNewOwner(address _owner) external
Modifiers
Emits
acceptOwnership
¶
If called by nominatedOwner
, ownership is transferred to that address.
The nominated owner is reset to the zero address.
Modifiers¶
onlyOwner
¶
Reverts the transaction if msg.sender
is not the owner
.
Events¶
OwnerNominated
¶
newOwner
has been set as the nominatedOwner
.
Signature: OwnerNominated(address newOwner)
OwnerChanged
¶
Ownership has been handed over from oldOwner
to newOwner
, which is the new value of owner
.
Signature: OwnerChanged(address oldOwner, address newOwner)