Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Apolloelephen/da4be91093a293e6db115bb8b9cfee76 to your computer and use it in GitHub Desktop.
Save Apolloelephen/da4be91093a293e6db115bb8b9cfee76 to your computer and use it in GitHub Desktop.
// 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