pragma solidity ^0.4.0; contract modifierTest{ bytes32 public blockhash; address public coinbase; uint public difficulty; uint public gaslimit; uint public blockNum; uint public timestamp; bytes public calldata1; uint public gas; address public sender; bytes4 public sig; uint public msgValue; uint public now1; uint public gasPrice; address public txOrigin; function tt(){ //给定区块号的哈希值,只支持最近256个区块,且不包含当前区块 blockhash = block.blockhash(block.number -1); coinbase = block.coinbase;//当前块矿工的地址 difficulty = block.difficulty;//当前块的难度 gaslimit = block.gaslimit;//当前块的gaslimit blockNum = block.number; //当前区块的块号 timestamp = block.timestamp;//当前块的时间戳==now calldata1 = msg.data;//完整的调用数据: 0x1e36169e gas = msg.gas;//当前还剩下的gas sender = msg.sender;//当前调用发起人的地址: 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c sig = msg.sig;//调用数据的前4个字节(函数标识符): 0x1e36169e msgValue = msg.value;//这个消息所携带的货币量,单位wei now1 = now; gasPrice = tx.gasprice;//交易的gas价格 txOrigin = tx.origin;//交易的发送者(完整的调用链): 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c } }
直接调用,后面无需()
原文地址:https://www.cnblogs.com/eilinge/p/9964167.html
时间: 2024-10-09 05:31:19