20 lines
332 B
Solidity
20 lines
332 B
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.28;
|
|
|
|
contract Counter {
|
|
uint public x;
|
|
|
|
event Increment(uint by);
|
|
|
|
function inc() public {
|
|
x++;
|
|
emit Increment(1);
|
|
}
|
|
|
|
function incBy(uint by) public {
|
|
require(by > 0, "incBy: increment should be positive");
|
|
x += by;
|
|
emit Increment(by);
|
|
}
|
|
}
|