Skip to content

Commit

Permalink
1inch-U32: move project_ lineage to daily_spellbook (#6321)
Browse files Browse the repository at this point in the history
* move project_ lineage to daily

* apply easy dates

* rm

* Update package-lock.yml

* rm

* Revert "apply easy dates"

This reverts commit cfa83e2.

* try project swaps from 2019

* rm yml description

* upd uniswap contracts
  • Loading branch information
grkhr authored Jul 5, 2024
1 parent 0ddb1e0 commit 76d004e
Show file tree
Hide file tree
Showing 85 changed files with 94 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@
, ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45', 'true', 'Uniswap' , 'SwapRouter02' , ['ethereum','polygon','arbitrum','optimism'])
, ('0x0000000052be00ba3a005edbe83a0fb9aadb964c', 'true', 'Uniswap' , 'UNDEFINED' , ['ethereum'])
, ('0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b', 'true', 'Uniswap' , 'UniversalRouter' , ['ethereum'])
, ('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', 'true', 'Uniswap' , 'UniversalRouter' , ['ethereum','bnb','polygon','arbitrum','optimism'])
, ('0x4dae2f939acf50408e13d58534ff8c2776d45265', 'true', 'Uniswap' , 'UniversalRouter' , ['bnb'])
, ('0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad', 'true', 'Uniswap' , 'UniversalRouter' , ['ethereum','bnb','polygon','arbitrum','optimism','base'])
, ('0x4dae2f939acf50408e13d58534ff8c2776d45265', 'true', 'Uniswap' , 'UniversalRouter' , ['bnb','avalanche_c'])
, ('0x5e325eda8064b456f4781070c0738d849c824258', 'true', 'Uniswap' , 'UniversalRouter' , ['arbitrum'])
, ('0x28731bcc616b5f51dd52cf2e4df0e78dd1136c06', 'true', 'Uniswap' , 'UniversalRouter' , ['zksync'])
, ('0xec7be89e9d109e7e3fec59c222cf297125fefda2', 'true', 'Uniswap' , 'UniversalRouter' , ['polygon'])
, ('0xcb1355ff08ab38bbce60111f1bb2b784be25d7e8', 'true', 'Uniswap' , 'UniversalRouter' , ['optimism'])
, ('0x5dc88340e1c5c6366864ee415d6034cadd1a9897', 'true', 'Uniswap' , 'UniversalRouter' , ['bnb'])
, ('0x4c60051384bd2d3c01bfc845cf5f4b44bcbe9de5', 'true', 'Uniswap' , 'UniversalRouter' , ['polygon','arbitrum'])
, ('0x643770e279d5d0733f21d6dc03a8efbabf3255b4', 'true', 'Uniswap' , 'UNDEFINED' , ['polygon'])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% macro oneinch_project_swaps_exposed_blockchains_list() %}
{{ return([
'ethereum',
'optimism',
'arbitrum',
'avalanche_c',
'polygon',
'bnb',
'gnosis',
'fantom',
'base',
]) }}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro
oneinch_project_calls_macro(
blockchain
, date_from = '2023-01-01'
, date_from = '2019-01-01'
)
%}

Expand All @@ -21,7 +21,8 @@ static as (
select
wrapped_native_token_address
, native_token_symbol as native_symbol
from ({{ oneinch_blockchain_macro(blockchain) }})
from {{ source('oneinch', 'blockchains') }}
where blockchain = '{{blockchain}}'
)

, contracts as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ logs as (
, count(*) over(partition by block_number, tx_hash, index) as log_call_trades -- trades for each log
from calls
full join logs using(blockchain, block_number, block_time, tx_hash, topic0)
join ({{ oneinch_blockchain_macro(blockchain) }}) using(blockchain)
join (
select * from {{ source('oneinch', 'blockchains') }}
where blockchain = '{{blockchain}}'
) using(blockchain)
where
coalesce(call_maker = log_maker, true)
and coalesce(call_taker = log_taker, true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro
oneinch_project_swaps_macro(
blockchain
, date_from = '2023-01-01'
, date_from = '2019-01-01'
)
%}

Expand All @@ -16,7 +16,8 @@ meta as (
chain_id
, wrapped_native_token_address
, native_token_symbol as native_symbol
from ({{ oneinch_blockchain_macro(blockchain) }})
from {{ source('oneinch', 'blockchains') }}
where blockchain = '{{blockchain}}'
)

, orders as (
Expand Down Expand Up @@ -57,12 +58,13 @@ meta as (
, flags as order_flags
from (
select *, row_number() over(partition by block_number, tx_hash order by call_trace_address) as counter
from {{ ref('oneinch_' + blockchain + '_lop') }}
from {{ source('oneinch', 'lop') }}
where
blockchain = '{{blockchain}}'
{% if is_incremental() %}
{{ incremental_predicate('block_time') }}
and {{ incremental_predicate('block_time') }}
{% else %}
block_time >= timestamp '{{date_from}}'
and block_time >= timestamp '{{date_from}}'
{% endif %}
and call_success
)
Expand Down Expand Up @@ -231,7 +233,10 @@ meta as (
, transfer_from
, transfer_to
, date_trunc('minute', block_time) as minute
from ({{ oneinch_parsed_transfers_from_calls_macro(blockchain) }}), meta
from (
select * from {{ source('oneinch', 'parsed_transfers_from_calls') }}
where blockchain = '{{blockchain}}'
), meta
where
{% if is_incremental() %}
{{ incremental_predicate('block_time') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



{% for blockchain in oneinch_exposed_blockchains_list() %}
{% for blockchain in oneinch_project_swaps_exposed_blockchains_list() %}
select * from ({{ oneinch_mapped_contracts_macro(blockchain) }})
{% if not loop.last %} union all {% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



{% for blockchain in oneinch_exposed_blockchains_list() %}
{% for blockchain in oneinch_project_swaps_exposed_blockchains_list() %}
select * from ({{ oneinch_mapped_methods_macro(blockchain) }})
{% if not loop.last %} union all {% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
}}


-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}

{{
oneinch_project_swaps_macro(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ meta as (
blockchain
, wrapped_native_token_address
, native_token_symbol as native_symbol
from {{ ref('oneinch_blockchains') }}
from {{ source('oneinch', 'blockchains') }}
)

, orders as (
Expand All @@ -57,7 +57,9 @@ meta as (
, date_trunc('minute', block_time) as minute
, row_number() over(partition by blockchain, block_number, tx_hash order by call_trace_address, order_hash) as counter
from (
{% for blockchain in oneinch_exposed_blockchains_list() %}
{% for blockchain in oneinch_project_swaps_exposed_blockchains_list() %}
{{ "-- depends_on: {{ ref('oneinch_' + blockchain + '_project_swaps') }}" }}

select
{{ orders_base_columns | join(', ') }}
, tag
Expand All @@ -83,7 +85,7 @@ meta as (
, null as order_deadline
, 1 as call_trade
, 1 as call_trades
from {{ ref('oneinch_lop') }}
from {{ source('oneinch', 'lop') }}
where call_success
)
join meta using(blockchain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@



{% for blockchain in oneinch_exposed_blockchains_list() %}
{% for blockchain in oneinch_project_swaps_exposed_blockchains_list() %}
{{ "-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}" }}

select * from {{ ref('oneinch_' + blockchain + '_project_swaps') }}
{% if not loop.last %} union all {% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_mapped_contracts') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_logs') }}
-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders_raw_traces') }}


{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
}}

-- depends_on: {{ ref('oneinch_' + blockchain + '_project_orders') }}


{{
Expand Down
Loading

0 comments on commit 76d004e

Please sign in to comment.