// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title Dagmar Contract * @dev Accepts ethereum and simulates a humorous relationship dynamic with Dagmar. */ contract Dagmar { using SafeMath for uint256; string[5] public reasons = [ "You forgot to put the toilet seat down!", "You finished the last slice of pizza without asking!", "You left your socks on the floor again!", "You used all the hot water in the shower!", "You forgot our anniversary!" ]; uint256 public argumentThreshold; uint256 public hystericalArgumentCount; event HystericalArgument(address indexed partner1, address indexed partner2, string reason); /** * @dev Constructor that initializes randomness. */ constructor() { argumentThreshold = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty))) % 10 + 1; } /** * @dev Simulates Dagmar's irresistible charm, resetting the argument count. */ function DagmarIrresistibleCharm() external { hystericalArgumentCount = 0; } /** * @dev Simulates a dramatic gesture of love, triggering a hysterical argument with a random reason. */ function dramaticLoveGesture() external { uint256 randomIndex = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender))) % 5; string memory reason = reasons[randomIndex]; emit HystericalArgument(msg.sender, address(this), reason); hystericalArgumentCount++; } }
0.4.18