mirror of
https://github.com/FlipsideCrypto/osmosis-models.git
synced 2026-02-06 11:47:03 +00:00
41 lines
866 B
SQL
41 lines
866 B
SQL
{{ config(
|
|
materialized = 'view',
|
|
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'MARS',
|
|
'PURPOSE': 'DEFI' }} },
|
|
tags = ['noncore'],
|
|
enabled = false
|
|
) }}
|
|
|
|
SELECT
|
|
block_id,
|
|
block_timestamp,
|
|
tx_id,
|
|
tx_succeeded,
|
|
msg_group,
|
|
msg_sub_group,
|
|
msg_index,
|
|
contract_name,
|
|
action,
|
|
USER,
|
|
asset_index,
|
|
denom AS currency,
|
|
rewards_accrued :: INT AS rewards_accrued,
|
|
COALESCE(
|
|
red_bank_actions_id,
|
|
{{ dbt_utils.generate_surrogate_key(
|
|
['tx_id','msg_index']
|
|
) }}
|
|
) AS ez_red_bank_balance_changes_id,
|
|
COALESCE(
|
|
inserted_timestamp,
|
|
'2000-01-01'
|
|
) AS inserted_timestamp,
|
|
COALESCE(
|
|
modified_timestamp,
|
|
'2000-01-01'
|
|
) AS modified_timestamp
|
|
FROM
|
|
{{ ref('silver__red_bank_actions') }}
|
|
WHERE
|
|
action = 'balance_change'
|