[Feature] Internal native asset transfers
Description
Currently, there is no way to track internal native asset (ex. ETH) transfers inside of an event handler.
This is because internal transactions are not tracked. This is problematic for figuring out the correct flow of assets during an event.
Specifically, we ran into this issue when creating the 0x community subgraphs. Since internal native asset transfers cannot be tracked, it is not possible to index and assemble full 0x trades in a subgraph using the graph-node without call handlers (which are not supported everywhere).
Ideally, there would be an array of internal transactions as part of the transaction class, where each one would at least have the native asset amount that was transferred. I.e can access these in an event handler like: event.transaction.internalTransfers
For example, you can see internal transactions for a transaction in etherscan:
Could use a feature flag to turn this on like the receipts flag is used today, so internal transactions are off by default speeding up indexing.
This was originally mentioned here (https://github.com/graphprotocol/graph-node/issues/297) in 2018, and was planned as part of "phase 2" but was never implemented.
Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.
No response
Some information to help us out
- [ ] Tick this box if you plan on implementing this feature yourself.
- [X] I have searched the issue tracker to make sure this issue is not a duplicate.
I'm facing the same challenge. I building a subgraph that tracks token swap on a certain dex on Polygon, and when the swap involves the native asset MATIC, I can't parse it from the event logs.
interesting to see how it's hard to track these transfers while with Smart Accounts being a reality, these type of transfers will be more and more needed to create great UX. Didn't check but ... hasn't been created an EIP to propose a sort of event-like emitted when internal transfers with value > 0 happens?
I'm not aware of an EIP for that @70nyIT, but indeed I think that could be an interesting addition to the client I think the original request would also require tracing so it might also not be available everywhere @spennyp?
Yes, we need tracing (this is why such an EIP could be a huge benefit to have this feature without relying on Archive Nodes). Or at least, this is the only way I've found so far to access those info.
@azf20 in case you missed it - there's an EIP to solve this problem proposed by Vitalik https://ethereum-magicians.org/t/eip-7708-eth-transfers-emit-a-log/20034/10
This is the last thing I need to fully adopt the graph for all my on chain data needs. I currently have an custom aka complicated solution for indexing native asset transfers for smart contract accounts. I would really appreciate this feature!
just curious, what's your flow @stewart-lore ? debug trace each block or a different approach?