-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...integration/pi_network/pi-network-interoperability/bridge-contracts/sidra-chain/Owner.sol
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
contract Owner { | ||
address public owner; | ||
address public newOwner; | ||
|
||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner, "Only the owner can call this function"); | ||
_; | ||
} | ||
|
||
constructor() public { | ||
owner = msg.sender; | ||
} | ||
|
||
function transferOwnership(address _newOwner) public onlyOwner { | ||
newOwner = _newOwner; | ||
} | ||
|
||
function acceptOwnership() public { | ||
require(msg.sender == newOwner, "Only the new owner can accept ownership"); | ||
emit OwnershipTransferred(owner, newOwner); | ||
owner = newOwner; | ||
newOwner = address(0); | ||
} | ||
} |