contract owned {
    event TransferOwnership(address _owner, address _newOwner);
    event OwnerUpdate(address _prevOwner, address _newOwner);
    event TransferByOwner(address fromAddress, address toAddress, uint tokens);
    event Pause();
    event Unpause();
    
    address public owner;
    address public newOwner = 0x0;
    bool public paused = false;

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

    modifier onlyOwner {
        require (msg.sender == owner);
        _;
    }
    
    // ------------------------------------------------------------------------
    // Modifier to make a function callable only when the contract is not paused.
    // ------------------------------------------------------------------------
    modifier whenNotPaused() {
        require(!paused);
        _;
    }
    
    // ------------------------------------------------------------------------
    // Modifier to make a function callable only when the contract is paused.
    // ------------------------------------------------------------------------
    modifier whenPaused() {
        require(paused);
        _;
    }
   
    // ------------------------------------------------------------------------
    // transfer owner to new address
    // ------------------------------------------------------------------------
    function transferOwnership(address _newOwner) public onlyOwner {
        require(_newOwner != owner);
        newOwner = _newOwner;
        emit TransferOwnership(owner, _newOwner);
    }
    
    // ------------------------------------------------------------------------
    // accept the ownership
    // ------------------------------------------------------------------------
    function acceptOwnership() public{
        require(msg.sender == newOwner);
        emit OwnerUpdate(owner, newOwner);
        owner = newOwner;
        newOwner = 0x0;
    }
      
    // ------------------------------------------------------------------------
    // called by the owner to pause, triggers stopped state
    // ------------------------------------------------------------------------
    function pause() public onlyOwner whenNotPaused {
        paused = true;
        emit Pause();
    }
    
    // ------------------------------------------------------------------------
    // called by the owner to unpause, returns to normal state
    // ------------------------------------------------------------------------
    function unpause() public onlyOwner whenPaused {
        paused = false;
        emit Unpause();
    }
}
function acceptOwnership() public{
    require(msg.sender == newOwner);
    emit OwnerUpdate(owner, newOwner);
    owner = newOwner;
    newOwner = 0x0;
}

// ------------------------------------------------------------------------
// accept the ownership
// ------------------------------------------------------------------------