contract Owned {
    address public owner;

    event OwnershipTransferred(address indexed _from, address indexed _to);

    constructor() public {
        owner = msg.sender;
    }

// ----------------------------------------------------------------------------
// This contract only defines a modifier but does not use it.
// It will be used in derived contracts.
// The function body is inserted where the special symbol
// "_;" in the definition of a modifier appears.
// This means that if the owner calls this function,
// the function is executed and otherwise, an exception is thrown.
// ----------------------------------------------------------------------------
    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

// ----------------------------------------------------------------------------
// Allows the current owner to transfer control of the contract to a newOwner.
// Using the modifier onlyOwner to check the caller.
//   @param newOwner, the address to accept ownership.
// ----------------------------------------------------------------------------
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0));
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }
}
// ----------------------------------------------------------------------------
// Owned contract
// The first one of published this smart contract is the owner of token.
// The Ownership is transferred to the other one.
//   @msg.sender is default parm of solidity.
// ----------------------------------------------------------------------------
function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
}

// ----------------------------------------------------------------------------
// Allows the current owner to transfer control of the contract to a newOwner.
// Using the modifier onlyOwner to check the caller.
//   @param newOwner, the address to accept ownership.
// ----------------------------------------------------------------------------