arbiter_core/console/
mod.rs

1//! This module contains the backend for the `console2.log` Solidity function so
2//! that these logs can be read in Arbiter.
3
4use revm_primitives::address;
5
6use super::*;
7
8const CONSOLE_ADDRESS: Address = address!("000000000000000000636F6e736F6c652e6c6f67");
9
10#[allow(clippy::all)]
11#[rustfmt::skip]
12#[allow(missing_docs)]
13pub(crate) mod abi;
14
15/// An inspector that collects `console2.log`s during execution.
16#[derive(Debug, Clone, Default)]
17pub struct ConsoleLogs(pub Vec<Bytes>);
18
19impl<DB: Database> Inspector<DB> for ConsoleLogs {
20    #[inline]
21    fn call(
22        &mut self,
23        _context: &mut EvmContext<DB>,
24        call: &mut CallInputs,
25    ) -> Option<CallOutcome> {
26        if call.contract == CONSOLE_ADDRESS {
27            self.0.push(call.input.clone());
28        }
29        None
30    }
31}