Skip to content

Instantly share code, notes, and snippets.

@Shashank-In
Created September 26, 2022 07:52
Show Gist options
  • Save Shashank-In/0adc22d34dea4778cbed8edd9d1e2181 to your computer and use it in GitHub Desktop.
Save Shashank-In/0adc22d34dea4778cbed8edd9d1e2181 to your computer and use it in GitHub Desktop.
// 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