Subgraph: list logs in a transaction class

Hi there,
The transaction class is defined as below, which doesn’t have any reference to the logs in one tx. I’d like to request a feature to have logs listed here.

One use case would be that in one tx, for example, a FlashLoan event as the trigger, the tokens can be transferred between many contracts. In order to map how the fund is traveled, I need to track all the Transfer events in a tx, to find out the journey of the funds.

class Transaction {
    hash: Bytes
    index: BigInt
    from: Address
    to: Address | null
    value: BigInt
    gasUsed: BigInt
    gasPrice: BigInt
    input: Bytes
    logs: [Event] // Can you add logs here? 
}
1 Like

Hi! This use-case makes sense. I think one potential challenge is parsing the events if they’re not emitted by a contract for which there is an ABI available (and potentially these logs could be emitted by any contract). Could potentially rely on some standard event signatures, though that isn’t foolproof. This could also potentially introduce the possibility of double counting, depending on the subgraph’s implementation logic, so would need to be handled with care.

@Leo is there any data availability challenge (i.e. would we always have the full set of logs for a given transaction?)

3 Likes

Hi! Caught up here, the challenge is log availability while indexing past blocks (via eth_getLogs) - the other logs aren’t available, so it would require another RPC call to fetch the receipt. We are moving towards firehose-driven indexing (see more on the Firehose here: Introducing the Firehose), which will make this easier to do. The firehose has been integrated in Graph Node and we are currently testing with Ethereum indexing

3 Likes