50 rows today at 7:50 AM
# | address | symbols | chains | total_received_btc | total_sent_btc | net_btc_balance |
---|---|---|---|---|---|---|
0 | Aave Ethereum cbBTC (aEthcbBTC) | cbBTC | Ethereum | 12283.772900430005 | 3227.565072259999 | 9056.207828170007 |
1 | uniBTC | pumpBTC,uniBTC,cbBTC,SolvBTC.BBN,stBTC,LBTC | Ethereum,Ethereum,Ethereum,Ethereum,Ethereum,Ethereum | 8628.309461846993 | 1690.338820849358 | 6937.970640997635 |
2 | Karak LBTC | LBTC | Ethereum | 3613.6168431100014 | 2.08162094 | 3611.5352221700014 |
3 | Aave Ethereum tBTC (aEthtBTC) | tBTC | Ethereum | 2472.4977127967027 | 918.6012167626442 | 1553.8964960340586 |
4 | Threshold BTC (tBTC) | cbBTC,SolvBTC,SolvBTC.BBN,tBTC,swBTC,FBTC | Ethereum,Ethereum,Ethereum,Ethereum,Ethereum,Ethereum | 1802.3205056363224 | 481.91887819318833 | 1320.4016274431342 |
5 | etherfi eBTC | cbBTC,LBTC,FBTC,cbBTC,tBTC | Base,Ethereum,Ethereum,Ethereum,Ethereum | 6735.632556568421 | 5523.365089554966 | 1212.2674670134547 |
6 | SY SolvBTC Babylon (SY-SolvBTC) | SolvBTC,SolvBTC.BBN | BNB,BNB | 1289.8432698907743 | 228.4729047308683 | 1061.370365159906 |
7 | 0xb3973d459df38ae57797811f2a1fd061da1bc123 | cbBTC | Ethereum | 1313.45476716 | 305.80991117 | 1007.64485599 |
8 | Morpho Blue | cbBTC,tBTC,uniBTC,SolvBTC,cbBTC,LBTC,swBTC | Base,Ethereum,Ethereum,Ethereum,Ethereum,Ethereum,Ethereum | 2521.2364673194725 | 1603.8841483468227 | 917.3523189726498 |
9 | 0x3ee18b2214aff97000d974cf647e7c347e8fa585 | tBTC,stBTC | Ethereum,Ethereum | 1665.06160731 | 842.6517941100001 | 822.4098131999999 |
10 | 0x9c0823d3a1172f9ddf672d438dec79c39a64f448 | LBTC | Ethereum | 676.99085719 | 1.6149142699999999 | 675.37594292 |
11 | Fuel Protocol | FBTC,SolvBTC,SolvBTC.BBN,pumpBTC | Ethereum,Ethereum,Ethereum,Ethereum | 914.3106964599997 | 248.771699771 | 665.5389966889998 |
12 | SY Lombard LBTC (SY-LBTC) | LBTC | Ethereum | 1044.713052550001 | 397.67336837000005 | 647.039684180001 |
13 | 0xf877acafa28c19b96727966690b2f44d35ad5976 | cbBTC | Base | 41383.610435300056 | 40856.29167526019 | 527.3187600398669 |
14 | 0xbdb9300b7cde636d9cd4aff00f6f009ffbbc8ee6 | cbBTC | Base | 4910.044459699993 | 4388.892872439995 | 521.1515872599985 |
15 | Lombard upLBTC | LBTC | Ethereum | 488.21046786 | 0.01 | 488.20046786 |
16 | 0x733428f811d11940ed1168dcc57e21a5660c8f68 | cbBTC | Ethereum | 1559.4790023 | 1108.93297277 | 450.54602952999994 |
17 | 0x78f9afec0afd297bea08098ed01719b0b0f19ab2 | pumpBTC | Ethereum | 404.23996301999983 | 28.852208149999996 | 375.38775486999987 |
18 | 0xfe19b102e3941c609645a8fb2a428038ebf5c725 | LBTC | Ethereum | 347.61661501000003 | 0 | 347.61661501000003 |
19 | 0x68c432ed964b3142480a1ac83d316ec64b5dd8a1 | FBTC | Ethereum | 704 | 404 | 300 |
20 | 0x781363e74e12281c8b24ee1eb507d1ae7ed117b2 | SolvBTC,SolvBTC.BBN | Ethereum,Ethereum | 600 | 300 | 300 |
21 | 0x9c9675855dd1f7f09984f64b4c4408ee82d1481d | LBTC | Ethereum | 300 | 0 | 300 |
22 | 0xf26237543b5d975a408fc530cbd66e3de920cdd4 | pumpBTC | Ethereum | 280 | 0 | 280 |
23 | 0xa841b47d3b67967d7b0fc660672206088ba882c4 | stBTC | BNB | 299.96997 | 40 | 259.96997 |
24 | 0x6b08ac95dc118f51173789584f127950a7c86763 | pumpBTC | Ethereum | 251.9666 | 0 | 251.9666 |
25 | 0xf6ae69ef729663d359b29bcad30338b880a2a9e6 | LBTC | Ethereum | 250.0103125 | 0 | 250.0103125 |
26 | 0x6d85d1c7f58fd5d05b1b633e8b0ce2e57fca9d80 | LBTC | Ethereum | 250.00523705 | 0.00523705 | 250 |
27 | 0x52aa899454998be5b000ad077a46bbe360f4e497 | cbBTC,cbBTC | Base,Ethereum | 2345.52403792 | 2098.549994939999 | 246.97404298000083 |
28 | 0x30ce4884c57aeb413b1ffe63fac8f6447a7d7205 | pumpBTC,pumpBTC | Ethereum,BNB | 951.08159517 | 708.99999999 | 242.08159518000002 |
29 | 0x2dfc08f4fad29761adf4cd9f1918296dc6f305c4 | LBTC,stBTC | Ethereum,BNB | 261.77948034165456 | 32.421710262681735 | 229.35777007897283 |
30 | 0x222a428f9b77b063c3f07038032b665be0c70c93 | LBTC | Ethereum | 222.15 | 0 | 222.15 |
31 | 0xd4f56e41e77e2594e89473c7ec03f3f8f6ed315b | LBTC,cbBTC | Ethereum,Ethereum | 563.3245610700001 | 363.13368777000005 | 200.19087330000002 |
32 | 0x0da6253560822973185297d5f32ff8fa38243afe | cbBTC | Ethereum | 3130.080944019998 | 2939.886457889998 | 190.19448612999986 |
33 | 0xd12ebf3bf2dd26cf93917fb5da4dbb99fd860b7d | LBTC | Ethereum | 189.88 | 0 | 189.88 |
34 | 0x6f5ec7c65c2744a963064f6d49df0f4eea7d7d90 | pumpBTC | Ethereum | 209.92367728 | 30.31612396 | 179.60755332 |
35 | 0xbbb1aa81e95298d64b7f710b936d89394dbdd28f | SolvBTC.BBN | BNB | 221.22577814186099 | 42.13730157886695 | 179.08847656299403 |
36 | 0x32611194b98b7ef451edf2a8bb0a11475ca8c287 | SolvBTC,FBTC | Ethereum,Ethereum | 3746.7321012475086 | 3572.516 | 174.2161012475085 |
37 | 0x7cdf271e0117b50405fe10cb2a21db8b79fbe905 | LBTC | Ethereum | 200 | 27 | 173 |
38 | 0xb6730d3c7e43ab99a0558c6caa5ce59fc393cea1 | SolvBTC.BBN | BNB | 236.93964217585938 | 65.66166109595201 | 171.27798107990736 |
39 | Sat Layer | LBTC,FBTC,SolvBTC.BBN,uniBTC,pumpBTC,stBTC,SolvBTC.BBN | Ethereum,Ethereum,Ethereum,Ethereum,Ethereum,BNB,BNB | 279.7854563635414 | 110.36105011545648 | 169.42440624808495 |
40 | Uniswap V3: LBTC - WBTC | LBTC | Ethereum | 1876.0699760000016 | 1707.7176300300002 | 168.35234597000135 |
41 | 0xb909f567c5c2bb1a4271349708cc4637d7318b4a | cbBTC | Base | 2565.250756140009 | 2401.6733465300435 | 163.57740960996534 |
42 | 0xc5d9ec1cf29af9f2d1f06647ae582d36fb0fd74a | FBTC,SolvBTC.BBN,SolvBTC,SolvBTC | Ethereum,Ethereum,Ethereum,BNB | 620.02715849 | 490.0270095 | 130.00014899 |
43 | 0x28c6c06298d514db089934071355e5743bf21d60 | BBTC (Binance) | Ethereum | 604.7591370099998 | 482.6692557000001 | 122.08988130999967 |
44 | 0xb99a2c4c1c4f1fc27150681b740396f6ce1cbcf5 | LBTC | Ethereum | 910.976 | 791 | 119.976 |
45 | 0x3fa890e71cccc48dac54cc69bfaf6fe86c650da3 | tBTC | Ethereum | 128.5045 | 10.011 | 118.49350000000001 |
46 | 0x3a29cd3052774224e7c2cf001254211c986967b2 | pumpBTC | Ethereum | 2000.2062193 | 1885.10308928 | 115.10313001999998 |
47 | 0xe8f7c89c5efa061e340f2d2f206ec78fd8f7e124 | cbBTC | Ethereum | 4405.717913660001 | 4293.221880439997 | 112.49603322000348 |
48 | 0xd6e85c739931fc5b7fad2c003ea343c0fe50fcaf | cbBTC,SolvBTC,cbBTC,SolvBTC.BBN,SolvBTC.BBN,SolvBTC,SolvBTC.BBN,SolvBTC | Base,Ethereum,Ethereum,Ethereum,BNB,BNB,Arbitrum,Arbitrum | 1614.8728055591837 | 1502.6890965535304 | 112.18370900565333 |
49 | 0x70acdf2ad0bf2402c957154f944c19ef4e1cbae1 | cbBTC | Base | 336366.78472174634 | 336256.84733821265 | 109.93738353368826 |
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
with
map(
'Ethereum', map(
unhex('0316EB71485b0Ab14103307bf65a021042c6d380'), ('0x0316EB71485b0Ab14103307bf65a021042c6d380', 'HBTC', 18, 'Derivative', 'Ethereum'),
unhex('eb4c2781e4eba804ce9a9803c67d0893436bb27d'), ('0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', 'renBTC', 8, 'Derivative', 'Ethereum'),
unhex('fe18be6b3bd88a2d2a7f928d00292e7a9963cfc6'), ('0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6', 'sBTC', 18, 'Derivative', 'Ethereum'),
unhex('18084fba666a33d37592fa2633fd49a74dd93a88'), ('0x18084fba666a33d37592fa2633fd49a74dd93a88', 'tBTC', 18, 'Derivative', 'Ethereum'),
unhex('3212b29E33587A00FB1C83346f5dBFA69A458923'), ('0x3212b29E33587A00FB1C83346f5dBFA69A458923', 'imBTC', 8, 'Derivative', 'Ethereum'),
unhex('0327112423f3a68efdf1fcf402f6c5cb9f7c33fd'), ('0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd', 'BTC++', 18, 'Derivative', 'Ethereum'),
unhex('C96dE26018A54D51c097160568752c4E3BD6C364'), ('0xC96dE26018A54D51c097160568752c4E3BD6C364', 'FBTC', 8, 'Derivative', 'Ethereum'),
unhex('9BE89D2a4cd102D8Fecc6BF9dA793be995C22541'), ('0x9BE89D2a4cd102D8Fecc6BF9dA793be995C22541', 'BBTC (Binance)', 8, 'Derivative', 'Ethereum'),
unhex('F5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC'), ('0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC', 'BBTC (BounceBit)', 18, 'Derivative', 'Ethereum'),
unhex('7A56E1C57C7475CCf742a1832B028F0456652F97'), ('0x7A56E1C57C7475CCf742a1832B028F0456652F97', 'SolvBTC', 18, 'Derivative', 'Ethereum'),
unhex('cbb7c0000ab88b473b1f5afd9ef808440eed33bf'), ('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', 'cbBTC', 8, 'Derivative', 'Ethereum'),
unhex('8236a87084f8B84306f72007F36F2618A5634494'), ('0x8236a87084f8B84306f72007F36F2618A5634494', 'LBTC', 8, 'Staked', 'Ethereum'),
unhex('bdf245957992bfbc62b07e344128a1eec7b7ee3f'), ('0xbdf245957992bfbc62b07e344128a1eec7b7ee3f', 'mBTC', 8, 'Staked', 'Ethereum'),
unhex('004E9C3EF86bc1ca1f0bB5C7662861Ee93350568'), ('0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568', 'uniBTC', 8, 'Staked', 'Ethereum'),
unhex('f6718b2701D4a6498eF77D7c152b2137Ab28b8A3'), ('0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3', 'stBTC', 18, 'Staked', 'Ethereum'),
unhex('F469fBD2abcd6B9de8E169d128226C0Fc90a012e'), ('0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e', 'pumpBTC', 8, 'Staked', 'Ethereum'),
unhex('8DB2350D78aBc13f5673A411D4700BCF87864dDE'), ('0x8DB2350D78aBc13f5673A411D4700BCF87864dDE', 'swBTC', 8, 'Restaked', 'Ethereum'),
unhex('d9D920AA40f578ab794426F5C90F6C731D159DEf'), ('0xd9D920AA40f578ab794426F5C90F6C731D159DEf', 'SolvBTC.BBN', 18, 'Restaked', 'Ethereum')
),
'Arbitrum', map(
unhex('6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40'), ('0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40', 'tBTC', 18, 'Derivative', 'Arbitrum'),
unhex('3647c54c4c2c65bc7a2d63c0da2809b399dbbdc0'), ('0x3647c54c4c2c65bc7a2d63c0da2809b399dbbdc0', 'SolvBTC', 18, 'Derivative', 'Arbitrum'),
unhex('f6718b2701D4a6498eF77D7c152b2137Ab28b8A3'), ('0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3', 'stBTC', 18, 'Staked', 'Arbitrum'),
unhex('346c574C56e1A4aAa8dc88Cda8F7EB12b39947aB'), ('0x346c574C56e1A4aAa8dc88Cda8F7EB12b39947aB', 'SolvBTC.BBN', 18, 'Restaked', 'Arbitrum'),
unhex('aFAfd68AFe3fe65d376eEC9Eab1802616cFacCb8'), ('0xaFAfd68AFe3fe65d376eEC9Eab1802616cFacCb8', 'SolvBTC.ENA', 18, 'Restaked', 'Arbitrum')
),
'BNB', map(
unhex('4aae823a6a0b376De6A78e74eCC5b079d38cBCf7'), ('0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7', 'SolvBTC', 18, 'Derivative', 'BNB'),
unhex('f9C4FF105803A77eCB5DAE300871Ad76c2794fa4'), ('0xf9C4FF105803A77eCB5DAE300871Ad76c2794fa4', 'pumpBTC', 8, 'Staked', 'BNB'),
unhex('f6718b2701D4a6498eF77D7c152b2137Ab28b8A3'), ('0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3', 'stBTC', 18, 'Staked', 'BNB'),
unhex('1346b618dc92810ec74163e4c27004c921d446a5'), ('0x1346b618dc92810ec74163e4c27004c921d446a5', 'SolvBTC.BBN', 18, 'Restaked', 'BNB'),
unhex('53E63a31fD1077f949204b94F431bCaB98F72BCE'), ('0x53E63a31fD1077f949204b94F431bCaB98F72BCE', 'SolvBTC.ENA', 18, 'Restaked', 'BNB')
),
'Base', map(
unhex('cbb7c0000ab88b473b1f5afd9ef808440eed33bf'), ('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', 'cbBTC', 8, 'Derivative', 'Base')
)
) as wrapped_btcs,
-- Calculate total BTC received by each recipient across chains
recipient_flows as (
-- Ethereum
select
input_1_value_address as address,
wrapped_btcs['Ethereum'][e.address].2 as symbol,
wrapped_btcs['Ethereum'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['Ethereum'][e.address].3)) as total_received_btc
from evm_events_ethereum_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['Ethereum'])
and input_1_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
UNION ALL
-- Arbitrum
select
input_1_value_address as address,
wrapped_btcs['Arbitrum'][e.address].2 as symbol,
wrapped_btcs['Arbitrum'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['Arbitrum'][e.address].3)) as total_received_btc
from evm_events_arbitrum_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['Arbitrum'])
and input_1_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
UNION ALL
-- BNB
select
input_1_value_address as address,
wrapped_btcs['BNB'][e.address].2 as symbol,
wrapped_btcs['BNB'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['BNB'][e.address].3)) as total_received_btc
from evm_events_bsc_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['BNB'])
and input_1_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
UNION ALL
-- Base
select
input_1_value_address as address,
wrapped_btcs['Base'][e.address].2 as symbol,
wrapped_btcs['Base'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['Base'][e.address].3)) as total_received_btc
from evm_events_base_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['Base'])
and input_1_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
),
-- Calculate total BTC sent by each sender address across chains
sender_flows as (
-- Ethereum
select
input_0_value_address as address,
wrapped_btcs['Ethereum'][e.address].2 as symbol,
wrapped_btcs['Ethereum'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['Ethereum'][e.address].3)) as total_sent_btc
from evm_events_ethereum_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['Ethereum'])
and input_0_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
UNION ALL
-- Arbitrum
select
input_0_value_address as address,
wrapped_btcs['Arbitrum'][e.address].2 as symbol,
wrapped_btcs['Arbitrum'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['Arbitrum'][e.address].3)) as total_sent_btc
from evm_events_arbitrum_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['Arbitrum'])
and input_0_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
UNION ALL
-- BNB
select
input_0_value_address as address,
wrapped_btcs['BNB'][e.address].2 as symbol,
wrapped_btcs['BNB'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['BNB'][e.address].3)) as total_sent_btc
from evm_events_bsc_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['BNB'])
and input_0_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
UNION ALL
-- Base
select
input_0_value_address as address,
wrapped_btcs['Base'][e.address].2 as symbol,
wrapped_btcs['Base'][e.address].5 as chain,
sum(cast(input_2_value_uint256 as double) / power(10, wrapped_btcs['Base'][e.address].3)) as total_sent_btc
from evm_events_base_mainnet_v1 e
where e.signature = 'Transfer(address,address,uint256)'
and e.address in mapKeys(wrapped_btcs['Base'])
and input_0_value_address != '0x0000000000000000000000000000000000000000'
and timestamp >= now() - interval 90 day
group by address, symbol, chain
),
-- Join received and sent flows to get both totals for each address
address_flows as (
select
coalesce(r.address, s.address) as address,
coalesce(r.symbol, s.symbol) as symbol,
coalesce(r.chain, s.chain) as chain,
coalesce(r.total_received_btc, 0) as total_received_btc,
coalesce(s.total_sent_btc, 0) as total_sent_btc
from recipient_flows r
full outer join sender_flows s
on r.address = s.address
and r.symbol = s.symbol
and r.chain = s.chain
)
select
CASE
WHEN address = '0x5c647ce0ae10658ec44fa4e11a51c96e94efd1dd' THEN 'Aave Ethereum cbBTC (aEthcbBTC)'
WHEN address = '0x8bc93498b861fd98277c3b51d240e7e56e48f23c' THEN 'uniBTC'
WHEN address = '0x657e8c867d8b37dcc18fa4caead9c45eb088c642' THEN 'etherfi eBTC'
WHEN address = '0x468c34703f6c648ccf39dbab11305d17c70ba011' THEN 'Karak LBTC'
WHEN address = '0x5401b8620e5fb570064ca9114fd1e135fd77d57c' THEN 'Lombard BTC Vault (LBTCv)'
WHEN address = '0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb' THEN 'Morpho Blue'
WHEN address = '0x10ac93971cdb1f5c778144084242374473c350da' THEN 'Aave Ethereum tBTC (aEthtBTC)'
WHEN address = '0x141ec2d606f12ff959d7d07cde6811e5fdff2831' THEN 'SY SolvBTC Babylon (SY-SolvBTC)'
WHEN address = '0xc781c0cc527cb8c351be3a64c690216c535c6f36' THEN 'SY Lombard LBTC (SY-LBTC)'
WHEN address = '0xab13b8eecf5aa2460841d75da5d5d861fd5b8a39' THEN 'Threshold BTC (tBTC)'
WHEN address = '0xa4ca04d02bfdc3a2df56b9b6994520e69df43f67' THEN 'Fuel Protocol'
WHEN address = '0x18a5a3d575f34e5eba92ac99b0976dbe26f9f869' THEN 'Lombard upLBTC'
WHEN address = '0x38d43a6cb8da0e855a42fb6b0733a0498531d774' THEN 'Swell Network - Simple Staking'
WHEN address = '0x42a856dbebb97abc1269eab32f3bb40c15102819' THEN 'Sat Layer'
WHEN address = '0x87428a53e14d24ab19c6ca4939b4df93b8996ca9' THEN 'Uniswap V3: LBTC - WBTC'
ELSE address -- Fallback to the actual wallet address if no label is found
END AS address,
symbols,
chains,
total_received_btc,
total_sent_btc,
(total_received_btc - total_sent_btc) as net_btc_balance
from (
select
distinct(address),
groupArray(symbol) as symbols, -- Aggregates symbols into an array
groupArray(chain) as chains, -- Aggregates chains into an array
sum(total_received_btc) as total_received_btc, -- Summed received BTC
sum(total_sent_btc) as total_sent_btc -- Summed sent BTC
from address_flows
group by address
) as aggregated_data
order by net_btc_balance desc
limit 50;