Skip to content

Commit

Permalink
feat(amplifier-api): failure event ids (#30)
Browse files Browse the repository at this point in the history
* feat(amplifier-api): failure event ids

For some failure events, the ids should be built differently.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* fix(amplifier-api): improve doc comment

---------

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
  • Loading branch information
frenzox committed Dec 18, 2024
1 parent 8b355a5 commit 08a2c0b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/amplifier-api/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ mod id {
pub fn new(tx_hash: &str, log_index: usize) -> Self {
Self(format!("{tx_hash}-{log_index}"))
}

/// Construct a new event id for a [`CannotExecuteMessageEvent`]
#[must_use]
pub fn cannot_execute_task_event_id(task_item_id: &TaskItemId) -> Self {
Self(format!("cannot-execute-task-v2-{}", task_item_id.0))
}

/// Construct a new event id for a [`MessageExecutedEvent`] with [`MessageExecutionStatus::Reverted`]
#[must_use]
pub fn tx_reverted_event_id(tx_hash: &str) -> Self {
Self(format!("tx-reverted-{tx_hash}"))
}
}

/// `NewType` for tracking message ids
Expand Down

0 comments on commit 08a2c0b

Please sign in to comment.