I am trying to calculate how much gas is spent for rUSDT token transfer transaction on RSK. If I go to RSK explorer rUSDT events page and pick up the first available transaction with a transfer event, I see that besides the transfer event I am interested in, it also includes 24 other events (sent, conversion, approval etc.). So the gas fee paid for this transaction (769,510 gas * 0.000000000065540656 RBTC c) consists of the amount of gas paid for all of these 24 events. Is there a way to "separate" transfers from the others and to calculate the gas fees paid only for them? My idea was to use a Covalent database to query RSK blockchain. I wrote this query to calculate gas fees paid for the last 20 transactions with transfer events.
SELECT encode(t.hash, 'hex'), t.gas_spent * t.gas_price / 10^18 AS gas_paid
FROM chain_rsk_mainnet.block_log_events e
INNER JOIN chain_rsk_mainnet.block_transactions t
ON e.block_id = t.block_id
AND e.tx_offset = t.tx_offset
WHERE e.topics[1] = E'\\xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
AND e.sender = E'\\xEf213441a85DF4d7acBdAe0Cf78004E1e486BB96'
AND e.block_signed_at > NOW() - INTERVAL '1 month' AND e.block_signed_at <= NOW()
AND t.signed_at > NOW() - INTERVAL '1 month' AND t.signed_at <= NOW()
ORDER BY e.block_id DESC, e.tx_offset DESC
LIMIT 20
where 0xEf213441a85DF4d7acBdAe0Cf78004E1e486BB96
is a rUSDT token address and 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
is a constant (ERC20 Transfer
event signature hash).
Is it possible to modify this query so as to calculate the gas paid separately for the token transfers?