// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; contract GasProbe { function probe(address target, bytes memory data) external view returns (uint256 gasUsed, bool ok, bytes memory ret) { uint256 before = gasleft(); (ok, ret) = target.staticcall(data); gasUsed = before - gasleft(); } }