kidaDaily Endowment aUST Snapshot
Updated 2022-04-20Copy Reference Fork
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
›
⌄
WITH endowments AS (
SELECT
msg_value:execute_msg:create_endowment:name as name,
event_attributes:contract_address as endowment_address,
msg_value:execute_msg:create_endowment:beneficiary as beneficiary
FROM terra.msgs m
JOIN terra.msg_events e
ON m.tx_id = e.tx_id
WHERE
m.tx_status = 'SUCCEEDED'
AND msg_value:contract = 'terra1nwk2y5nfa5sxx6gtxr84lre3zpnn7cad2f266h'
AND msg_value:execute_msg:create_endowment is not null
AND event_type = 'instantiate_contract'
),
donation_details AS (
select
block_timestamp,
tx_id,
msg_index,
split(key, '_')[0]::decimal as number,
MAX(IFF(CONTAINS(key, 'deposit_amount'), value, null)) as deposit_amount,
MAX(IFF(CONTAINS(key, 'mint_amount'), value, null)) as mint_amount,
MAX(IFF(CONTAINS(key, 'sender'), value, '')) as sender
from terra.msg_events,
lateral flatten( input => event_attributes )
where event_type = 'from_contract'
and (CONTAINS(key, 'mint_amount') OR CONTAINS(key, 'deposit_amount') OR CONTAINS(key, 'sender'))
AND event_attributes:"0_contract_address" = 'terra19cevhng6nunl7gmc90sph0syuqyvtqn7mlhwz0'
AND event_attributes:"0_action" = 'deposit'
AND tx_status = 'SUCCEEDED'
AND block_timestamp >= '2021-10-11'
GROUP BY block_timestamp, tx_id, number, msg_index
Run a query to Download Data