Skip to content

Commit

Permalink
refactor(torii-indexer): add token contract address to task identifier (
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo authored Feb 5, 2025
1 parent 1d2381c commit b751c50
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/torii/indexer/src/processors/erc20_legacy_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ where

fn task_identifier(&self, event: &Event) -> TaskId {
let mut hasher = DefaultHasher::new();
// Hash the event key (Transfer)
event.keys[0].hash(&mut hasher);
// Hash the contract address
event.from_address.hash(&mut hasher);

// Take the max of from/to addresses to get a canonical representation
// This ensures transfers between the same pair of addresses are grouped together
Expand Down
4 changes: 2 additions & 2 deletions crates/torii/indexer/src/processors/erc20_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ where

fn task_identifier(&self, event: &Event) -> TaskId {
let mut hasher = DefaultHasher::new();
// Hash the event key (Transfer)
event.keys[0].hash(&mut hasher);
// Hash the contract address
event.from_address.hash(&mut hasher);

// Take the max of from/to addresses to get a canonical representation
// This ensures transfers between the same pair of addresses are grouped together
Expand Down
4 changes: 2 additions & 2 deletions crates/torii/indexer/src/processors/erc721_legacy_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ where

fn task_identifier(&self, event: &Event) -> TaskId {
let mut hasher = DefaultHasher::new();
// Hash the event key (Transfer)
event.keys[0].hash(&mut hasher);
// Hash the contract address
event.from_address.hash(&mut hasher);

// Take the max of from/to addresses to get a canonical representation
// This ensures transfers between the same pair of addresses are grouped together
Expand Down
4 changes: 2 additions & 2 deletions crates/torii/indexer/src/processors/erc721_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ where

fn task_identifier(&self, event: &Event) -> TaskId {
let mut hasher = DefaultHasher::new();
// Hash the event key (Transfer)
event.keys[0].hash(&mut hasher);
// Hash the contract address
event.from_address.hash(&mut hasher);

// Take the max of from/to addresses to get a canonical representation
// This ensures transfers between the same pair of addresses are grouped together
Expand Down

0 comments on commit b751c50

Please sign in to comment.