Skip to content

Commit

Permalink
feat(papyrus_base_layer): add message canceled event
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilad Chase committed Dec 24, 2024
1 parent 643514d commit df5d733
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 @@ -32,8 +32,8 @@ impl TryFrom<Log> for L1Event {
Starknet::StarknetEvents::MessageToL2Canceled(event) => {
Ok(L1Event::MessageToL2Canceled(event.try_into()?))
}
Starknet::StarknetEvents::MessageToL2CancellationStarted(_event) => {
todo!()
Starknet::StarknetEvents::MessageToL2CancellationStarted(event) => {
Ok(L1Event::MessageToL2CancellationStarted(event.try_into()?))
}
_ => Err(EthereumBaseLayerError::UnhandledL1Event(log)),
}
Expand All @@ -54,6 +54,20 @@ impl TryFrom<Starknet::MessageToL2Canceled> for EventData {
}
}

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

fn try_from(event: Starknet::MessageToL2CancellationStarted) -> 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 df5d733

Please sign in to comment.