Created
August 20, 2022 19:02
-
-
Save libert-xyz/7aa47a09a95fcfef0dbb919473b2f4b5 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.16+commit.07a7930e.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
contract Ownable { | |
address public owner; | |
uint public counter; | |
uint public counterPublic; | |
constructor () { | |
owner = msg.sender; //set the owner at deploy time | |
} | |
modifier isOwner(address _owner) { | |
require(_owner == owner, "You are not the owner"); | |
_; | |
} | |
function onlyOwnercanIncrease() external isOwner(msg.sender) { | |
counter += 1; | |
} | |
function transferOwnership(address _newOwner) external isOwner(msg.sender) { | |
require (_newOwner != address(0), "Set a valid address"); | |
owner = _newOwner; | |
} | |
function publicFunction() external { | |
counterPublic += 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment