contract SafeOwnable {

    // EVENTS

    event OwnershipProposed(address indexed previousOwner, address indexed newOwner);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    // PUBLIC FUNCTIONS

    /// @dev The SafeOwnable constructor sets the original `owner` of the contract to the sender account.
    constructor() internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

    /// @dev Allows the current owner to propose control of the contract to a new owner.
    /// @param newOwner The address to propose ownership to.
    function proposeOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0) && newOwner != _owner);
        _ownerCandidate = newOwner;
        emit OwnershipProposed(_owner, _ownerCandidate);
    }

    /// @dev Allows the current owner candidate to accept proposed ownership and set actual owner of a contract.
    function acceptOwnership() public onlyOwnerCandidate {
        emit OwnershipTransferred(_owner, _ownerCandidate);
        _owner = _ownerCandidate;
        _ownerCandidate = address(0);
    }

    /// @dev Returns the address of the owner.
    function owner() public view returns (address) {
        return _owner;
    }

    /// @dev Returns the address of the owner candidate.
    function ownerCandidate() public view returns (address) {
        return _ownerCandidate;
    }

    // MODIFIERS

    /// @dev Throws if called by any account other than the owner.
    modifier onlyOwner() {
        require(msg.sender == _owner);
        _;
    }

    /// @dev Throws if called by any account other than the owner candidate.
    modifier onlyOwnerCandidate() {
        require(msg.sender == _ownerCandidate);
        _;
    }

    // FIELDS

    address internal _owner;
    address internal _ownerCandidate;
}
/// @title SafeOwnable
/// @dev The SafeOwnable contract has an owner address, and provides basic authorization control
/// functions, this simplifies the implementation of "user permissions".
function ownerCandidate() public view returns (address) {
    return _ownerCandidate;
}

/// @dev Returns the address of the owner candidate.