Skip to content

Commit

Permalink
Adds contract_address to context
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-herasme committed Jun 28, 2024
1 parent ba36304 commit ecc19b3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ghost-crab/src/handler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::indexer::TemplateManager;
use crate::process_logs::ExecutionMode;
use alloy::primitives::Address;
use alloy::providers::RootProvider;
use alloy::rpc::types::eth::Log;
use alloy::transports::http::{Client, Http};
Expand All @@ -10,6 +11,7 @@ pub struct Context {
pub log: Log,
pub provider: RootProvider<Http<Client>>,
pub templates: TemplateManager,
pub contract_address: Address
}

pub type HandleInstance = Arc<Box<(dyn Handler + Send + Sync)>>;
Expand Down
1 change: 1 addition & 0 deletions ghost-crab/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ pub use crate::indexer;
pub use crate::indexer::Template;
pub use crate::process_logs;
pub use alloy::providers::Provider;
pub use alloy::primitives::Address;
4 changes: 3 additions & 1 deletion ghost-crab/src/process_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub async fn process_logs(
);

let filter = Filter::new()
.address(address)
.address(address.clone())
.event(&event_signature)
.from_block(current_block)
.to_block(end_block);
Expand All @@ -70,6 +70,7 @@ pub async fn process_logs(
log,
provider,
templates,
contract_address: address
})
.await;
});
Expand All @@ -86,6 +87,7 @@ pub async fn process_logs(
log,
provider,
templates,
contract_address: address
})
.await;
}
Expand Down

0 comments on commit ecc19b3

Please sign in to comment.