-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemitter.sol
32 lines (27 loc) · 932 Bytes
/
emitter.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SpecialVariablesReader {
// Define events to emit special variables
event Coinbase(address indexed coinbase);
event GasPrice(uint256 indexed gasPrice);
event BlockHash(uint256 indexed blockNumber, bytes32 blockHash);
event BaseFee(uint256 indexed baseFee);
// Emit the COINBASE (i.e., the address of the block miner)
function emitCoinbase() public {
emit Coinbase(block.coinbase);
}
// Emit the GASPRICE of the transaction
function emitGasPrice() public {
emit GasPrice(tx.gasprice);
}
// Emit the BASEFEE of the transaction
function emitBaseFee() public {
emit BaseFee(block.basefee);
}
// Emit all special variables: COINBASE, GASPRICE, BASEFEE
function emitAllSpecialVariables() public {
emitCoinbase();
emitGasPrice();
emitBaseFee();
}
}