|
|
|
@ -6,19 +6,19 @@ import Web3 from 'web3' |
|
|
|
|
export const GlobalVariables = ({ block, receipt, tx, className }) => { |
|
|
|
|
// see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties
|
|
|
|
|
const globals = { |
|
|
|
|
'block.chainid': tx.chainId, |
|
|
|
|
'block.coinbase': block.miner, |
|
|
|
|
'block.difficulty': block.difficulty, |
|
|
|
|
'block.gaslimit': block.gasLimit, |
|
|
|
|
'block.number': block.number, |
|
|
|
|
'block.timestamp': block.timestamp, |
|
|
|
|
'msg.sender': tx.from, |
|
|
|
|
'msg.sig': tx.input.substring(0, 10), |
|
|
|
|
'msg.value': tx.value + ' Wei', |
|
|
|
|
'tx.origin': tx.from |
|
|
|
|
'block.chainid': tx && tx.chainId, |
|
|
|
|
'block.coinbase': block && block.miner, |
|
|
|
|
'block.difficulty': block && block.difficulty, |
|
|
|
|
'block.gaslimit': block && block.gasLimit, |
|
|
|
|
'block.number': block && block.number, |
|
|
|
|
'block.timestamp': block && block.timestamp, |
|
|
|
|
'msg.sender': tx && tx.from, |
|
|
|
|
'msg.sig': tx && tx.input && tx.input.substring(0, 10), |
|
|
|
|
'msg.value': tx && (tx.value + ' Wei'), |
|
|
|
|
'tx.origin': tx && tx.from |
|
|
|
|
} |
|
|
|
|
if (block.baseFeePerGas) { |
|
|
|
|
globals['block.basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` |
|
|
|
|
globals['block.basefee'] = block && (Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})`) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|