// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract MyContract { address public owner; constructor() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner, "Only owner can call this function"); _; } function setOwner(address newOwner) public onlyOwner { require(newOwner != address(0), "New owner cannot be zero address"); owner = newOwner; } }