Loading...
These are special variables which exist in global workspace and provide information about the blockchain and transaction properties.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract g_variables {
function block_info() public view returns(address payable, uint, uint, uint, uint){
return (block.coinbase, block.difficulty, block.gaslimit, block.number, block.timestamp);
}
function msg_info() public payable returns(bytes calldata, address, bytes4, uint){
return (msg.data, msg.sender, msg.sig, msg.value);
}
function tx_info() public view returns(uint, address, uint256){
return (tx.gasprice, tx.origin, gasleft());
}
}