// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract ShrimpHash {
address payable public owner;
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
event FundsWithdrawn(address indexed owner, uint256 amount);
event FundsReceived(address indexed sender, uint256 amount);
constructor() {
owner = payable(msg.sender);
}
function shrimpHash(string memory _string) public pure returns(bytes32) {
return keccak256(abi.encodePacked(_string));
}
function transferOwnership(address payable newOwner) public {
require(msg.sender == owner, "Only owner can transfer ownership");
require(newOwner != address(0), "New owner cannot be the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function withdrawFunds() public {
require(msg.sender == owner, "Only owner can withdraw funds");
uint256 amount = address(this).balance;
emit FundsWithdrawn(owner, amount);
owner.transfer(amount);
}
receive() external payable {
emit FundsReceived(msg.sender, msg.value);
}
}
{
"compilationTarget": {
"ShrimpHash.sol": "ShrimpHash"
},
"evmVersion": "cancun",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_string","type":"string"}],"name":"shrimpHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address payable","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]