// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
/**
* @title UTStamp
*/
contract UTStamp {
address public owner;
string public stamp;
event StampCommit(string indexed stampIndex, string stamp);
modifier isOwner() {
require(msg.sender == owner, "Caller is not owner");
_;
}
modifier validate(string memory newStamp) {
require(bytes(newStamp).length == 64, "stamp length should be 64");
_;
}
constructor() {
owner = msg.sender;
}
function commitStamp(string memory newStamp)
public
isOwner
validate(newStamp)
{
emit StampCommit(newStamp, newStamp);
stamp = newStamp;
}
}
{
"compilationTarget": {
"UTStamp.sol": "UTStamp"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"stampIndex","type":"string"},{"indexed":false,"internalType":"string","name":"stamp","type":"string"}],"name":"StampCommit","type":"event"},{"inputs":[{"internalType":"string","name":"newStamp","type":"string"}],"name":"commitStamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stamp","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]