Current status:
Optimism data isn’t currently available since Optimism’s regenesis.
Since Optimism’s regenesis, fee-data has been unavailable.
Previously, fee data was collected using a custom subgraph tracking the ETH ERC-20 token. Since regenesis, all Optimism subgraphs are unavailable, so this data is unavailable as well.
Post-regenesis, ETH is a native asset, not an ERC-20 token, meaning we can’t track it using subgraphs and transfer events. Fee data is still collected in the address 0x4200000000000000000000000000000000000011, meaning that the best way to track fees is probably to query the ETH balance of this address at the beginning/end of each day.
The one time this would break down is in the case that ETH is transferred out of this address by the operator. This case still requires some investigation, however it can hopefully be indexed by a subgraph.
I think the best way to get Optimism running again would be (like you said) to check the balance of 0x4200000000000000000000000000000000000011
at the start and end of each day. If you want to account for the edge case you mentioned, you can simply filter out WithdrawalInitialized
events from 0x4200000000000000000000000000000000000010
:
event WithdrawalInitiated(
address indexed _l1Token,
address indexed _l2Token,
address indexed _from,
address _to,
uint256 _amount,
bytes _data
);
So the total fees on a daily basis would be:
total_fees = balance_day_end - balance_day_start + amount_withdrawn
Where amount_withdrawn
can be found by searching for WithdrawalInitialized
events where _from == 0x4200000000000000000000000000000000000011
.
created adapter for Optimism fees:
- Using TheGraph to track withdrawn fees
https://thegraph.com/hosted-service/subgraph/ap0calyp/optimism-fee-withdrawn - Using getBalance to track eth balance of “'0x4200000000000000000000000000000000000011”
- Using coingecko to get the eth historical price for that date
(minor revisions of refactoring added after 0.1.0 …)