Skip to content

Commit

Permalink
feat(papyrus_base_layer): add consumed message
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilad Chase committed Dec 24, 2024
1 parent ee4639b commit 7b11a24
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions crates/papyrus_base_layer/src/eth_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ impl TryFrom<Log> for L1Event {
};
Ok(L1Event::LogMessageToL2 { tx, fee })
}
Starknet::StarknetEvents::ConsumedMessageToL2(_event) => {
todo!()
Starknet::StarknetEvents::ConsumedMessageToL2(event) => {
Ok(L1Event::ConsumedMessageToL2(event.try_into()?))
}
Starknet::StarknetEvents::MessageToL2Canceled(event) => {
Ok(L1Event::MessageToL2Canceled(event.try_into()?))
Expand Down Expand Up @@ -104,6 +104,20 @@ impl TryFrom<Starknet::LogMessageToL2> for EventData {
}
}

impl TryFrom<Starknet::ConsumedMessageToL2> for EventData {
type Error = EthereumBaseLayerError;

fn try_from(event: Starknet::ConsumedMessageToL2) -> EthereumBaseLayerResult<Self> {
create_l1_event_data(
event.fromAddress,
event.toAddress,
event.selector,
&event.payload,
event.nonce,
)
}
}

pub fn create_l1_event_data(
from_address: EthereumContractAddress,
to_address: U256,
Expand Down

0 comments on commit 7b11a24

Please sign in to comment.