// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title Counter
* @notice Minimal, clean contract for CI self-testing.
* No external calls, proper access control, zero vulnerability surface.
*/
contract Counter {
address public immutable owner;
uint64 private _count;
event CountIncremented(uint256 newCount);
event CountReset(uint256 previousCount);
modifier onlyOwner() {
require(msg.sender == owner, "Counter: not owner");
_;
}
constructor() {
owner = msg.sender;
}
/// @notice Anyone can increment the counter
function increment() external {
_count += 1;
emit CountIncremented(_count);
}
/// @notice Owner can reset the counter
function reset() external onlyOwner {
uint256 prev = _count;
_count = 0;
emit CountReset(prev);
}
/// @notice Get the current count
function count() external view returns (uint256) {
return _count;
}
}