Skip to content

Commit

Permalink
Add block_date to oneinch ar
Browse files Browse the repository at this point in the history
  • Loading branch information
aalan3 committed Jul 4, 2024
1 parent d91e512 commit 24a8b8f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro
{% macro
oneinch_ar_handle_generic(
contract,
contract_data,
Expand All @@ -15,6 +15,7 @@
select
call_block_number as block_number
, call_block_time as block_time
, date(date_trunc('day', call_block_time)) as block_date
, call_tx_hash as tx_hash
, '{{ contract }}' as contract_name
, '{{ contract_data.version }}' as protocol_version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro
{% macro
oneinch_ar_handle_unoswap(
contract,
contract_data,
Expand All @@ -16,6 +16,7 @@
select
block_number
, block_time
, date(date_trunc('day', call_block_time)) as block_date
, tx_hash
, '{{ contract }}' as contract_name
, '{{ contract_data.version }}' as protocol_version
Expand Down
19 changes: 10 additions & 9 deletions dex/macros/models/_project/oneinch/AR/oneinch_ar_macro.sql
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{% macro
{% macro
oneinch_ar_macro(
blockchain
)
)
%}



{% set native = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' %}


with
with
-- pools tokens for unoswap lineage tokens parsing
pools_list as (
select
pool as pool_address
, tokens
from {{ ref('dex_raw_pools') }}
where
where
type in ('uniswap_compatible', 'curve_compatible')
and blockchain = '{{ blockchain }}'
group by 1, 2
Expand All @@ -25,7 +25,7 @@ pools_list as (

, calls as (
{% for contract, contract_data in oneinch_ar_cfg_contracts_macro().items() if blockchain in contract_data.blockchains %}

select * from (
with traces_cte as (
select
Expand All @@ -51,10 +51,10 @@ pools_list as (
{% endif %}
)


{% for method, method_data in contract_data.methods.items() if blockchain in method_data.get('blockchains', contract_data.blockchains) %} -- method-level blockchains override contract-level blockchains
{% if method_data.router_type in ['generic', 'clipper'] %}
{{
{{
oneinch_ar_handle_generic(
contract=contract,
contract_data=contract_data,
Expand All @@ -63,8 +63,8 @@ pools_list as (
blockchain=blockchain,
traces_cte=traces_cte,
start_date=contract_data['start'],
)
}}
)
}}
{% elif method_data.router_type in ['unoswap'] %}
{{
oneinch_ar_handle_unoswap(
Expand All @@ -90,6 +90,7 @@ select
blockchain
, block_number
, block_time
, block_date
, tx_hash
, tx_from
, tx_to
Expand Down

0 comments on commit 24a8b8f

Please sign in to comment.