forked from dojoengine/dojo
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
92 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//! This module contains a hooker trait, that is added to katana in order to | ||
//! allow external code to react at some precise moment of katana processing. | ||
//! | ||
use async_trait::async_trait; | ||
use starknet::core::types::BroadcastedInvokeTransaction; | ||
use starknet::accounts::Call; | ||
|
||
#[async_trait] | ||
pub trait KatanaHooker { | ||
/// Runs code right before an invoke transaction | ||
/// is being added to the pool. | ||
/// Returns true if the transaction should be included | ||
/// in the pool, false otherwise. | ||
/// | ||
/// # Arguments | ||
/// | ||
/// * `transaction` - The invoke transaction to be verified. | ||
async fn verify_invoke_tx_before_pool( | ||
&self, | ||
transaction: BroadcastedInvokeTransaction, | ||
) -> bool; | ||
|
||
/// Runs code right before a message to starknet | ||
/// is being sent via a direct transaction. | ||
/// As the message is sent to starknet in a transaction | ||
/// the `Call` of the transaction is being verified. | ||
/// | ||
/// # Arguments | ||
/// | ||
/// * `call` - The `Call` to inspect, built from the | ||
/// message. | ||
async fn verify_message_to_starknet_before_tx( | ||
&self, | ||
call: Call, | ||
) -> bool; | ||
|
||
/// Runs when Solis attempts to execute an order on Starknet, | ||
/// but it fails. | ||
/// | ||
/// # Arguments | ||
/// | ||
/// * `call` - The `Call` of the transaction that has failed. | ||
/// Usually the same as `verify_message_to_starknet_before_tx`. | ||
async fn react_on_starknet_tx_failed( | ||
&self, | ||
call: Call, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters