Created
September 26, 2022 07:52
-
-
Save Shashank-In/0adc22d34dea4778cbed8edd9d1e2181 to your computer and use it in GitHub Desktop.
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: GPL-3.0 | |
pragma solidity 0.8.7; | |
contract Test { | |
address public owner; | |
constructor() { | |
owner = msg.sender; | |
} | |
//event creation with argument types and names | |
event ownerChanged(address indexed _from, address indexed _to); | |
function changeOwner(address _newOwner) public payable { | |
//emitting the event | |
emit ownerChanged(owner, _newOwner); | |
//changing ownership | |
owner = _newOwner; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment