Skip to content

Commit

Permalink
feat: add additional logs to DSTest abi (#1916)
Browse files Browse the repository at this point in the history
* feat: add additional logs to DSTest abi

* fix: properly decode named array logs
  • Loading branch information
mds1 authored Jun 11, 2022
1 parent 6859f04 commit e43a1dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions evm/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub fn decode_console_log(log: &Log) -> Option<String> {
format!("{}: 0x{}", inner.key, hex::encode(inner.val))
}
LogNamedStringFilter(inner) => format!("{}: {}", inner.key, inner.val),
LogNamedArray1Filter(inner) => format!("{}: {:?}", inner.key, inner.val),
LogNamedArray2Filter(inner) => format!("{}: {:?}", inner.key, inner.val),

e => e.to_string(),
};
Expand Down
7 changes: 6 additions & 1 deletion evm/src/executor/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ pub static HARDHAT_CONSOLE_ADDRESS: Address = H160([
0x2e, 0x6c, 0x6f, 0x67,
]);

// Bindings for DS-style event logs
// Bindings for DS-style event logs. Note that the array logs below are not actually part of DSTest,
// but are part of forge-std, so are included here to ensure they are decoded in output logs.
ethers::contract::abigen!(
Console,
r#"[
Expand All @@ -92,6 +93,8 @@ ethers::contract::abigen!(
event log_uint (uint)
event log_bytes (bytes)
event log_string (string)
event log_array (uint256[] val)
event log_array (int256[] val)
event log_named_address (string key, address val)
event log_named_bytes32 (string key, bytes32 val)
event log_named_decimal_int (string key, int val, uint decimals)
Expand All @@ -100,6 +103,8 @@ ethers::contract::abigen!(
event log_named_uint (string key, uint val)
event log_named_bytes (string key, bytes val)
event log_named_string (string key, string val)
event log_named_array (string key, uint256[] val)
event log_named_array (string key, int256[] val)
]"#
);
pub use console_mod::{ConsoleEvents, CONSOLE_ABI};
Expand Down

0 comments on commit e43a1dd

Please sign in to comment.