S Price: $0.81552 (-4.11%)

Contract Diff Checker

Contract Name:
BasicAhhContract

Contract Source Code:

File 1 of 1 : BasicAhhContract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract BasicAhhContract {
  
  address payable public owner;
  string public message;
  
  event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
  event FundsWithdrawn(address indexed owner, uint256 amount);
  event FundsReceived(address indexed sender, uint256 amount);
  event StringUpdated(string newString);

  constructor() {
    owner = payable(msg.sender);
  }

  function setMessage(string memory _newString) public {
    require(msg.sender == owner, "Only owner can set message");
    message = _newString;
    emit StringUpdated(_newString);
  }

  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, smh");
    
    uint256 amount = address(this).balance;
    emit FundsWithdrawn(owner, amount);
    
    owner.transfer(amount);
  }

  receive() external payable {
    emit FundsReceived(msg.sender, msg.value);
  }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):