Skip to content

Commit

Permalink
1inch-U51: fixes to project.* lineage (#7184)
Browse files Browse the repository at this point in the history
* fixes to project.* lineage

* fixes & improvements & easy dates

- updated a mode definition
- updated a project definition
- added partitions by projects

* revert easy dates

* expose zksync

* easy dates

* Revert "easy dates"

This reverts commit b60169a.

---------

Co-authored-by: grkhr <[email protected]>
  • Loading branch information
max-morrow and grkhr authored Dec 3, 2024
1 parent e588cb3 commit aafa1e7
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'bnb',
'gnosis',
'fantom',
'base',
'base',
'zksync',
]) }}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
{% set _taker_data = "4 + 32*4 + bytearray_to_bigint(substr(input, 4 + 32*13 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _taker_data ~ " + 32*1 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x3f62192e",
"tag": "'UniswapXV1'",
"name": "execute",
Expand All @@ -501,7 +501,7 @@
{% set _taker_data = "4 + 32*5 + bytearray_to_bigint(substr(input, 4 + 32*14 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _taker_data ~ " + 32*1 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x0d335884",
"tag": "'UniswapXV1'",
"name": "executeWithCallback",
Expand All @@ -528,7 +528,7 @@
{% set _taker_data = "bytearray_to_bigint(substr(input, " ~ _order_beginning ~ " + 32*12 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _order_beginning ~ " + " ~ _taker_data ~ " + 32*4 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x0d7a16c3",
"tag": "'UniswapXV1'",
"name": "executeBatch",
Expand Down Expand Up @@ -557,7 +557,7 @@
{% set _taker_data = "bytearray_to_bigint(substr(input, " ~ _order_beginning ~ " + 32*12 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _order_beginning ~ " + " ~ _taker_data ~ " + 32*4 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x13fb72c7",
"tag": "'UniswapXV1'",
"name": "executeBatchWithCallback",
Expand All @@ -584,7 +584,7 @@
{% set _taker_data = "4 + 32*1 + bytearray_to_bigint(substr(input, 4 + 32*10 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _taker_data ~ " + 32*4 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x3f62192e",
"tag": "'UniswapXV2'",
"name": "execute",
Expand All @@ -610,7 +610,7 @@
{% set _taker_data = "4 + 32*2 + bytearray_to_bigint(substr(input, 4 + 32*11 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _taker_data ~ " + 32*4 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x0d335884",
"tag": "'UniswapXV2'",
"name": "executeWithCallback",
Expand Down Expand Up @@ -638,7 +638,7 @@
{% set _taker_data = "bytearray_to_bigint(substr(input, " ~ _order_beginning ~ " + 32*9 + 24 + 1, 8))" %}
{% set _recipients = "bytearray_to_bigint(substr(input, " ~ _order_beginning ~ " + " ~ _taker_data ~ " + 32*4 + 24 + 1, 8))" %}
{% set methods = methods + [{
"project": "Uniswap",
"project": "UniswapX",
"selector": "0x13fb72c7",
"tag": "'UniswapXV2'",
"name": "executeBatchWithCallback",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ meta as (
block_number
, tx_hash
, call_trace_address
, project
, project as order_project
, order_hash
, maker
, taker
Expand All @@ -51,7 +51,7 @@ meta as (
block_number
, tx_hash
, call_trace_address
, '1inch' as project
, '1inch' as order_project
, coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int)))) as order_hash
, maker
, receiver as taker
Expand Down Expand Up @@ -81,7 +81,7 @@ meta as (
, tx_from
, tx_to
, call_trace_address
, project
, coalesce(order_project, project) as project
, tag
, flags
, call_selector
Expand Down Expand Up @@ -116,7 +116,7 @@ meta as (
and call_success
and (flags['cross_chain'] or not flags['cross_chain_method']) -- without cross-chain methods calls in non cross-chain protocols
)
left join orders using(block_number, tx_hash, call_trace_address, project)
left join orders using(block_number, tx_hash, call_trace_address)
join meta on true
where
reduce(call_trace_addresses, true, (r, x) -> if(r and x <> call_trace_address and slice(call_trace_address, 1, cardinality(x)) = x, false, r), r -> r) -- only not nested calls of the project in tx
Expand Down Expand Up @@ -314,11 +314,36 @@ meta as (
select
*
, map_from_entries(array[
('classic: direct', flags['direct'] and order_hash is null and not auction and not cross_chain_swap or second_side)
, ('classic: external', not flags['direct'] and order_hash is null and not auction and not cross_chain_swap)
, ('intent: intra-chain auction', auction and not cross_chain_swap)
, ('intent: intra-chain user limit order', order_hash is not null and not auction and not cross_chain_swap and not contracts_only)
, ('intent: intra-chain contracts only', contracts_only)
('intra-chain: classic: direct',
flags['direct']
and order_hash is null
and not auction
and not cross_chain_swap
and not contracts_only
or second_side
)
, ('intra-chain: classic: external',
not flags['direct']
and order_hash is null
and not auction
and not contracts_only
and not cross_chain_swap
)
, ('intra-chain: intents: auction',
auction
and not cross_chain_swap
)
, ('intra-chain: intents: user limit order',
order_hash is not null
and not auction
and not cross_chain_swap
and not contracts_only
and not second_side
)
, ('intra-chain: intents: contracts only',
contracts_only
and not second_side
)
, ('cross-chain', cross_chain_swap)
]) as modes
from (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
config(
schema = 'oneinch_' + blockchain,
alias = 'project_swaps',
partition_by = ['block_month'],
partition_by = ['block_month', 'project'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down

0 comments on commit aafa1e7

Please sign in to comment.