METRIC | VALUE | |
---|---|---|
1 | deposit_volume_usd | 85526005996.8411 |
0xE98281cb548523652657f4686479e1757624911CDeposit_Volume
Updated 3 days ago
999
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
›
⌄
--------------------------------------------------------------------------------
-- 1. Extract Deposit actions related to BankLiquidityVault for computing deposit volume
-- Source: solana.core.fact_decoded_instructions
-- Note: This query takes a "protocol-level" perspective. The 'bankLiquidityVault'
-- account reflects the protocol's asset inflow, which can be used to measure user deposits into MarginFi.
--------------------------------------------------------------------------------
WITH deposit_actions AS (
SELECT DISTINCT
a.block_timestamp, -- Deposit time, used for hourly price matching
a.decoded_instruction:"args":"amount"::FLOAT AS deposit_raw_amount, -- Deposit amount (raw, not normalized by decimals)
acc.value:"pubkey"::STRING AS deposit_token_address -- Token account receiving the deposit (bankLiquidityVault)
FROM solana.core.fact_decoded_instructions a,
LATERAL FLATTEN(input => a.decoded_instruction:"accounts") acc -- Flatten account list from decoded instruction
WHERE a.program_id = 'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA' -- MarginFi V2 Program ID
AND a.event_type = 'lendingAccountDeposit' -- Filter for deposit events
AND acc.value:"name"::STRING = 'bankLiquidityVault' -- Must be the bankLiquidityVault (protocol inflow)
-- From protocol perspective, bankLiquidityVault represents the core account for asset inflow/outflow.
-- It is used to measure deposit activity at the protocol level.
),
--------------------------------------------------------------------------------
-- 2. Map Token Account to Mint for identifying token types
-- Source: solana.core.fact_token_balances
-- This table maps each token account (SPL ATA) to its corresponding mint address
-- Note: Token accounts (ATA) are linked to their mint addresses for metadata lookup
--------------------------------------------------------------------------------
token_info AS (
SELECT DISTINCT account_address, -- SPL Token Account (ATA)
mint -- Associated token mint (unique identifier)
FROM solana.core.fact_token_balances tf
WHERE EXISTS (
SELECT 1
FROM deposit_actions da
WHERE da.deposit_token_address = tf.account_address
)
),
Last run: 3 days ago
1
41B
202s