ETH Price: $2,407.46 (-3.92%)
Gas: 1.18 Gwei

Transaction Decoder

Block:
22623859 at Jun-03-2025 11:34:23 AM +UTC
Transaction Fee:
0.000089011831169364 ETH $0.21
Gas Used:
39,714 Gas / 2.241321226 Gwei

Emitted Events:

Account State Difference:

  Address   Before After State Difference Code
(Titan Builder)
6.682339652236177801 Eth6.682363657370864605 Eth0.000024005134686804
0x5Ff57006...dE18E6Fe7
0.001486259889641142 Eth
Nonce: 56
0.001368248058471778 Eth
Nonce: 57
0.000118011831169364
0x7500A83D...17d876a85 0.12048746783955896 Eth0.12051646783955896 Eth0.000029
0xc5C68144...A78f6e63E

Execution Trace

ETH 0.000029 OnChainGM.CALL( )
  • ETH 0.000029 0x7500a83df2af99b2755c47b6b321a8217d876a85.CALL( )
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.28;
    
    contract OnChainGM {
        // Immutable variables don't use storage slots
        address public immutable feeRecipient;
        uint256 public immutable GM_FEE;
        uint256 public constant TIME_LIMIT = 24 hours;
        
        // Mapping to store last GM timestamp for each user
        mapping(address => uint256) public lastGMTimestamp;
        
        // Event for tracking GMs
        event OnChainGMEvent(address indexed sender);
        
        constructor() {
            feeRecipient = 0x7500A83DF2aF99B2755c47B6B321a8217d876a85;
            GM_FEE = 0.000029 ether;
        }
        
        // Gas optimized GM function with timestamp check
        function onChainGM() external payable {
            if (msg.value != GM_FEE) {
                revert("Incorrect ETH fee");
            }
            
            // Check if 24 hours have passed since last GM
            if (!(block.timestamp >= lastGMTimestamp[msg.sender] + TIME_LIMIT || lastGMTimestamp[msg.sender] == 0)) {
                revert("Wait 24 hours");
            }
            
            // Update last GM timestamp
            lastGMTimestamp[msg.sender] = block.timestamp;
            
            // Transfer fee after all checks
            (bool success,) = feeRecipient.call{value: msg.value}("");
            if (!success) {
                revert("Fee transfer failed");
            }
            
            emit OnChainGMEvent(msg.sender);
        }
        
        // View function to check remaining time
        function timeUntilNextGM(address user) external view returns (uint256) {
            if (lastGMTimestamp[user] == 0) return 0;
            
            uint256 timePassed = block.timestamp - lastGMTimestamp[user];
            if (timePassed >= TIME_LIMIT) return 0;
            
            return TIME_LIMIT - timePassed;
        }
    }