elsinaUntitled Query
Updated 2022-04-20
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
›
⌄
{{ config(
materialized = 'table',
unique_key = 'MONTH',
incremental_strategy = 'delete+insert',
cluster_by = ['MONTH'],
tags = ['snowflake', 'terra', 'console', 'terra_monthly_active_users']
) }}
WITH active_wallets AS (
SELECT
date_trunc('month', block_timestamp) as date,
coalesce(
msg_value:sender,
msg_value: msgs[0]:"from_address", -- Used by authz/MsgExec
msg_value: granter, -- Used by 'authz/MsgGrant', 'feegrant/MsgGrantAllowance'
msg_value: depositor, -- Used by gov/MsgDeposit
msg_value: proposer, -- gov/MsgSubmitProposal
msg_value: voter, -- 'gov/MsgVote'
msg_value: trader, -- market/MsgSwap
msg_value: from_address,
msg_value: to_address,
msg_value: delegator_address, -- 'staking/MsgBeginRedelegate','staking/MsgCreateValidator','staking/MsgDelegate','staking/MsgUndelegate'
msg_value: owner,
msg_value: signer
) as address
FROM {{ ref('terra__msgs') }}
WHERE tx_status = 'SUCCEEDED'
AND address IS NOT NULL
AND date >= CURRENT_DATE - interval '7 month'
AND date < date_trunc('month',CURRENT_DATE)
AND msg_type IN (
'applications/transfer.v1.MsgTransfer' -- IBC Application Transfer for user, MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between ICS20 enabled chains.,
,'authz/MsgExec' -- When a grantee wants to execute a transaction on behalf of a granter, they must send MsgExec.,
,'authz/MsgGrant' -- MsgGrantAllowance adds permission for Grantee to spend up to Allowance,
Run a query to Download Data