Created
April 3, 2024 09:45
-
-
Save Apolloelephen/da4be91093a293e6db115bb8b9cfee76 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: MIT | |
pragma solidity ^0.8.17; | |
contract EventContract { | |
uint public counter = 0; | |
event LogAddress(address indexed _sender, string _message); | |
event LogDeposit(address indexed _from, uint _amount, string _message); | |
event LogValueIncrease(address indexed _owner, uint _oldValue, uint _newValue, string _message); | |
function emitEvents() public payable { | |
emit LogAddress(msg.sender, "Log message emitted"); | |
emit LogDeposit(msg.sender, msg.value, "Deposit successful"); | |
} | |
function increaseCounter() public { | |
uint oldCounter = counter; | |
counter++; | |
emit LogValueIncrease(msg.sender, oldCounter, counter, "Counter increased"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment