How to get contract ids when indexing log data receipts?

Hey,

I’m trying to build an indexer for NFT ownership. I assume that all nft contracts on chain emit the following log event on every NFT transfer (sway):

pub struct TransferEvent {
    from: Identity,
    sender: Identity,
    to: Identity,
    token_id: u64,
}

As the doc implies, I need to write the following function in my rust indexer entry point:

fn handle_transfer_event(event: TransferEvent)

But that way I can get only the fields of the TransferEvent entity, but I cannot access other LogData fields like the contract id which produced the event.

So, 2 questions:

  • is it the right way to index NFTs on Fuel or does indexer work with specific contract ids only when indexing log data receipts?
  • (if yes) how to get the contract id which produced the TransferEvent that I get in the function input?