Skip to content

Commit

Permalink
🚧 wip: binary_mode check + wrapping, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nuts-rice committed Jan 7, 2025
1 parent 1fbebe9 commit 32f7731
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
44 changes: 44 additions & 0 deletions core/src/database/postgres/sql_type_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,13 +944,32 @@ pub fn solidity_type_to_ethereum_sql_type_wrapper(
pub fn map_log_params_to_ethereum_wrapper(
abi_inputs: &[ABIInput],
params: &[LogParam],
binary_mode: bool,
) -> Vec<EthereumSqlTypeWrapper> {
let mut wrappers = vec![];

for (index, param) in params.iter().enumerate() {
if let Some(abi_input) = abi_inputs.get(index) {
match &param.value {
Token::Tuple(tuple) => {
if binary_mode {
wrappers.extend(process_tuple(
abi_input
.components
.as_ref()
.expect("tuple should have a component ABI on"),
tuple,
));
map_ethereum_wrapper_to_byte(
abi_input
.components
.as_ref()
.expect("tuple should have component ABI on"),
&wrappers,
true,
);
todo!()
}
wrappers.extend(process_tuple(
abi_input
.components
Expand All @@ -960,6 +979,20 @@ pub fn map_log_params_to_ethereum_wrapper(
));
}
_ => {
if binary_mode {
wrappers.push(map_log_token_to_ethereum_wrapper(abi_input, &param.value));
map_ethereum_wrapper_to_byte(
abi_input
.components
.as_ref()
.expect("value should have component ABI on"),
&wrappers,
false,
);

todo!()
}

wrappers.push(map_log_token_to_ethereum_wrapper(abi_input, &param.value));
}
}
Expand All @@ -971,6 +1004,17 @@ pub fn map_log_params_to_ethereum_wrapper(
wrappers
}

pub fn map_ethereum_wrapper_to_byte(
abi_inputs: &[ABIInput],
wrapper: &[EthereumSqlTypeWrapper],
// transaction_information: &TxInformation,
is_within_tuple: bool,
) -> Bytes {
let mut buf = bytes::BytesMut::new();
for abi_input in abi_inputs.iter() {}
unimplemented!()
}

fn process_tuple(abi_inputs: &[ABIInput], tokens: &[Token]) -> Vec<EthereumSqlTypeWrapper> {
let mut wrappers = vec![];

Expand Down
4 changes: 1 addition & 3 deletions core/src/manifest/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ impl Storage {
if !enabled {
return false;
}
self.postgres
.as_ref()
.map_or(false, |details| details.binary_storage.unwrap_or_default())
self.postgres.as_ref().map_or(false, |details| details.binary_storage.unwrap_or_default())
}

pub fn postgres_drop_each_run(&self) -> bool {
Expand Down

0 comments on commit 32f7731

Please sign in to comment.