pragma solidity ^0.7.0;
// "SPDX-License-Identifier: UNLICENSED"
contract Hashes {
event HashAdded(address indexed sender, bytes32 hash, uint256 blockNumber);
mapping (bytes32 => uint256) private hashes;
function addHash (bytes32 _hash) public {
require(hashes[_hash] == 0, "The hash was already added");
hashes[_hash] = block.number;
emit HashAdded(msg.sender, _hash, block.number);
}
function findHash (bytes32 _hash) public view returns(uint) {
return hashes[_hash];
}
}
{
"compilationTarget": {
"browser/fsdafsdnotary.sol": "Hashes"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"HashAdded","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_hash","type":"bytes32"}],"name":"addHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_hash","type":"bytes32"}],"name":"findHash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]