Initial commit
This commit is contained in:
20
backend/contracts/MyContract.sol
Normal file
20
backend/contracts/MyContract.sol
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user