Having a Token without an owner, do I need an Owned contract and onlyOwner in a constructor?

by Damir Olejar   Last Updated October 18, 2019 20:28 PM - source

Example of an owned contract:

contract Owned {
   address public owner;
   address public newOwner;

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

   function Owned() public {
       owner = msg.sender;

   modifier onlyOwner {
       require(msg.sender == owner);

   function transferOwnership(address _newOwner) public onlyOwner {
       newOwner = _newOwner;
   function acceptOwnership() public {
       require(msg.sender == newOwner);
       OwnershipTransferred(owner, newOwner);
       owner = newOwner;
       newOwner = address(0);


Which is then used in a main contract constructor...

 function sometoken() public onlyOwner{

The code example is solidity 4.x... I am developing in 5.x

If there is no need for an Owned contract, what would be the safest code (having no contract owner) to use instead ? What would constructor look like ?

Tags : solidity tokens

Related Questions

smart contract for crowdsale

Updated February 05, 2018 19:28 PM

CrowdSale basic contract sample showing Gas limit error

Updated February 07, 2018 14:28 PM