CallRecorder.sol 418 Bytes
Newer Older
1
// SPDX-License-Identifier: MIT
2
pragma solidity ^0.8.0;
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

contract CallRecorder {
    struct CallInfo {
        address sender;
        bytes data;
        uint256 gas;
        uint256 value;
    }

    CallInfo public lastCall;

    function record() public payable {
        lastCall.sender = msg.sender;
        lastCall.data = msg.data;
        lastCall.gas = gasleft();
        lastCall.value = msg.value;
    }
}