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

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


Updated February 05, 2018 19:28 PM

Updated December 29, 2017 10:28 AM

Updated February 09, 2018 18:28 PM

Updated February 23, 2018 09:28 AM

Updated February 07, 2018 14:28 PM