You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dbt_subprojects/daily_spellbook/macros/project/oneinch/project/cfg/oneinch_project_orders_cfg_methods_macro.sql
{% for event, event_data in oneinch_project_orders_cfg_events_macro().items() %}
14
16
select
15
17
'{{ blockchain }}'as blockchain
16
-
, '{{event_data["project"]}}'as project
18
+
, '{{ event_data["project"] }}'as project
19
+
, block_date
17
20
, block_number
18
-
, block_time
19
21
, tx_hash
20
22
, tx_from
21
23
, tx_to
@@ -51,25 +53,26 @@ logs as (
51
53
, topic2
52
54
, topic3
53
55
, data
54
-
, row_number() over(partition by block_number, tx_hash order by index) aslog_counter
56
+
, row_number() over(partition by block_number, tx_hash order by index) astrade_counter
55
57
from {{ ref('oneinch_'+ blockchain +'_project_orders_raw_logs') }}
56
-
where
57
-
topic0 = {{ event }}
58
-
and {% if is_incremental() %}{{ incremental_predicate('block_time') }}
59
-
{% else %}block_time >=timestamp'{{date_from}}'
60
-
{% endif %}
58
+
where true
59
+
and topic0 = {{ event }}
60
+
and block_time >=timestamp'{{ date_from }}'
61
+
{% if is_incremental() %}and {{ incremental_predicate('block_time') }}{% endif %}
61
62
{% if not loop.last %}union all{% endif %}
62
63
{% endfor %}
63
64
)
64
65
65
66
, calls as (
66
-
select*, row_number() over(partition by block_number, tx_hash, call_to, method order by call_trace_address, call_trade) as call_trade_counter -- trade counter in the tx: there may be multiple calls and multiple trades within a call in a single transaction
67
+
select*
68
+
, row_number() over(partition by block_number, tx_hash, call_to, method order by call_trace_address, call_trade) as trade_counter -- trade counter in the tx: there may be multiple calls and multiple trades within a call in a single transaction
67
69
from (
68
70
select
69
71
blockchain
70
72
, project
71
73
, tag
72
74
, flags
75
+
, block_date
73
76
, block_number
74
77
, block_time
75
78
, tx_hash
@@ -120,6 +123,7 @@ logs as (
120
123
, project
121
124
, tag
122
125
, flags
126
+
, block_date
123
127
, block_number
124
128
, block_time
125
129
, tx_hash
@@ -137,7 +141,7 @@ logs as (
137
141
, {{ item.get("event", "null") }} as topic0
138
142
, coalesce({{ item.get("number", "1") }}, 1) as call_trades -- total trades in the call
139
143
, transform(sequence(1, coalesce({{ item.get("number", "1") }}, 1)), x -> map_from_entries(array[
0 commit comments