pub trait BlockAccess {
// Required methods
fn block_basefee(&self) -> U256;
fn block_coinbase(&self) -> Address;
fn block_number(&self) -> u64;
fn block_timestamp(&self) -> u64;
fn block_gas_limit(&self) -> u64;
}Expand description
Provides access to host methods relating to the block a transaction to a Stylus contract is included in.
Required Methods§
Sourcefn block_basefee(&self) -> U256
fn block_basefee(&self) -> U256
Gets the basefee of the current block. The semantics are equivalent to that of the EVM’s
BASEFEE opcode.
Sourcefn block_coinbase(&self) -> Address
fn block_coinbase(&self) -> Address
Gets the coinbase of the current block, which on Arbitrum chains is the L1 batch poster’s address. This differs from Ethereum where the validator including the transaction determines the coinbase.
Sourcefn block_number(&self) -> u64
fn block_number(&self) -> u64
Gets a bounded estimate of the L1 block number at which the Sequencer sequenced the
transaction. See Block Numbers and Time for more information on how this value is
determined.
Sourcefn block_timestamp(&self) -> u64
fn block_timestamp(&self) -> u64
Gets a bounded estimate of the Unix timestamp at which the Sequencer sequenced the
transaction. See Block Numbers and Time for more information on how this value is
determined.
Sourcefn block_gas_limit(&self) -> u64
fn block_gas_limit(&self) -> u64
Gets the gas limit of the current block. The semantics are equivalent to that of the EVM’s
GAS_LIMIT opcode. Note that as of the time of this writing, evm.codes incorrectly
implies that the opcode returns the gas limit of the current transaction. When in doubt,
consult The Ethereum Yellow Paper.