Right now a stranger can set the rate to anything. Watch: the second call lands and rate ends at 99.
Record the deployer, using a constructor that runs once at deploy:
address public owner;
constructor() {
owner = msg.sender;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract Treasury {
uint256 public rate;
function setRate(uint256 newRate) external {
rate = newRate;
}
function reset() external {
rate = 0;
}
}