marquprimary asset deposits - drift
Updated 2024-11-28
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with
deposit_txs as (
select
fact_decoded_instructions.block_timestamp
, fact_decoded_instructions.tx_id
, fact_decoded_instructions.decoded_instruction
, fact_token_account_owners.account_address
, fact_token_account_owners.owner
, fact_token_balances.pre_balance
, fact_token_balances.balance
, fact_token_balances.balance - fact_token_balances.pre_balance as balance_delta
, fact_token_balances.mint
from solana.core.fact_decoded_instructions
left join solana.core.fact_token_account_owners
on fact_decoded_instructions.decoded_instruction :accounts[4] :pubkey = fact_token_account_owners.account_address -- Spot Market Vault
left join solana.core.fact_token_balances
using(block_timestamp, tx_id, account_address, owner)
where fact_decoded_instructions.program_id = 'dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH'
and fact_decoded_instructions.event_type = 'deposit'
and block_timestamp ::date > current_date() - interval '30 days'
),
aggregated as (
select
date_trunc('day', block_timestamp) as date
, mint as token_address
, sum(balance_delta) as amount_token
from deposit_txs
QueryRunArchived: QueryRun has been archived