Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.21;
- contract SpecialVariables {
- function exec() public payable returns (
- address block_coinbase,
- uint256 block_difficulty,
- uint256 block_gaslimit,
- uint256 block_number,
- uint256 block_timestamp,
- uint256 gas_left,
- bytes msg_data,
- address msg_sender,
- bytes4 msg_sig,
- uint256 msg_value,
- uint256 tx_gasprice,
- address tx_origin
- ) {
- block_coinbase = block.coinbase; // current block miner’s address
- block_difficulty = block.difficulty; // current block difficulty
- block_gaslimit = block.gaslimit; // current block gaslimit
- block_number = block.number; // current block number
- block_timestamp = block.timestamp; // current block timestamp as seconds since unix epoch
- gas_left = gasleft(); // remaining gas
- msg_data = msg.data; // complete calldata
- msg_sender = msg.sender; // sender of the message (current call)
- msg_sig = msg.sig; // first four bytes of the calldata (i.e. function identifier)
- msg_value = msg.value; // number of wei sent with the message
- tx_gasprice = tx.gasprice; // gas price of the transaction
- tx_origin = tx.origin; // sender of the transaction (full call chain)
- }
- function getBlockhash(uint256 blockNumber) public view returns (bytes32) {
- /// hash of the given block - only works for 256 most recent,
- /// excluding current, blocks - deprecated in version 0.4.22
- /// and replaced by blockhash(uint blockNumber).
- return blockhash(blockNumber);
- }
- }
Add Comment
Please, Sign In to add comment