Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Balancer and Hashflow to dex.trades_migration_beta #4149

Merged
merged 7 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions models/balancer/arbitrum/balancer_arbitrum_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: arbitrum
project: balancer
Expand All @@ -174,6 +173,7 @@ models:
- &version
name: version
description: "Version of the project"
- *block_month
- *block_date
- *block_time
- &token_bought_symbol
Expand Down Expand Up @@ -226,9 +226,6 @@ models:
- &tx_to
name: tx_to
description: "transaction.to"
- &trace_address
name: trace_address
description: ""
- *evt_index

- name: balancer_v2_arbitrum_liquidity
Expand Down Expand Up @@ -340,7 +337,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: arbitrum
project: balancer
Expand Down Expand Up @@ -370,5 +366,4 @@ models:
- name: tx_hash
- name: tx_from
- name: tx_to
- name: trace_address
- name: evt_index
2 changes: 1 addition & 1 deletion models/balancer/arbitrum/balancer_arbitrum_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ FROM (
blockchain,
project,
version,
block_month,
block_date,
block_time,
token_bought_symbol,
Expand All @@ -39,7 +40,6 @@ FROM (
tx_hash,
tx_from,
tx_to,
trace_address,
evt_index
FROM {{ dex_model }}
{% if not loop.last %}
Expand Down
4 changes: 1 addition & 3 deletions models/balancer/arbitrum/balancer_v2_arbitrum_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'],
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'],
post_hook = '{{ expose_spells(\'["arbitrum"]\',
"project",
"balancer_v2",
Expand Down Expand Up @@ -49,7 +49,6 @@ WITH
swap.poolId AS pool_id,
swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee,
swap.evt_tx_hash AS tx_hash,
'' AS trace_address,
swap.evt_index
FROM
swap_fees
Expand Down Expand Up @@ -140,7 +139,6 @@ SELECT
dexs.tx_hash,
tx."from" AS tx_from,
tx.to AS tx_to,
dexs.trace_address,
dexs.evt_index
FROM
dexs
Expand Down
13 changes: 4 additions & 9 deletions models/balancer/avalanche_c/balancer_avalanche_c_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: avalanche_c
project: balancer
Expand All @@ -35,6 +34,9 @@ models:
- &version
name: version
description: "Version of the project"
- &block_month
name: block_month
description: "Block month in UTC"
- &block_date
name: block_date
description: "Block date in UTC"
Expand Down Expand Up @@ -95,9 +97,6 @@ models:
- &tx_to
name: tx_to
description: "transaction.to"
- &trace_address
name: trace_address
description: "Trace address"
- &evt_index
name: evt_index
description: "Event index"
Expand All @@ -120,7 +119,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: avalanche_c
project: balancer
Expand Down Expand Up @@ -150,7 +148,6 @@ models:
- name: tx_hash
- name: tx_from
- name: tx_to
- name: trace_address
- name: evt_index

- name: balancer_avalanche_c_pools_tokens_weights
Expand Down Expand Up @@ -273,9 +270,7 @@ models:
name: contract_address
description: "Address of BPT being transfered"
- *block_date
- &block_month
name: block_month
description: "UTC event block month"
- *block_month
- *evt_index
- &evt_block_time
name: evt_block_time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ FROM (
blockchain,
project,
version,
block_month,
block_date,
block_time,
token_bought_symbol,
Expand All @@ -40,7 +41,6 @@ FROM (
tx_hash,
tx_from,
tx_to,
trace_address,
evt_index
FROM {{ dex_model }}
{% if not loop.last %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'],
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'],
post_hook = '{{ expose_spells(\'["avalanche_c"]\',
"project",
"balancer_v2",
Expand Down
6 changes: 3 additions & 3 deletions models/balancer/balancer_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ models:
- &version
name: version
description: "Version of the project"
- &block_month
name: block_month
description: "Block month in UTC"
- &block_date
name: block_date
description: "Block date in UTC"
Expand Down Expand Up @@ -80,9 +83,6 @@ models:
- &tx_to
name: tx_to
description: "transaction.to"
- &trace_address
name: trace_address
description: ""
- &evt_index
name: evt_index
description: 'Event index'
Expand Down
2 changes: 1 addition & 1 deletion models/balancer/balancer_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FROM (
blockchain,
project,
version,
block_month,
block_date,
block_time,
token_bought_symbol,
Expand All @@ -47,7 +48,6 @@ FROM (
tx_hash,
tx_from,
tx_to,
trace_address,
evt_index
FROM {{ dex_model }}
{% if not loop.last %}
Expand Down
12 changes: 4 additions & 8 deletions models/balancer/base/balancer_base_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: base
project: balancer
Expand All @@ -35,6 +34,9 @@ models:
- &version
name: version
description: "Version of the project"
- &block_month
name: block_month
description: "Block month in UTC"
- &block_date
name: block_date
description: "Block date in UTC"
Expand Down Expand Up @@ -95,9 +97,6 @@ models:
- &tx_to
name: tx_to
description: "transaction.to"
- &trace_address
name: trace_address
description: "Trace address"
- &evt_index
name: evt_index
description: "Event index"
Expand All @@ -120,7 +119,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: base
project: balancer
Expand Down Expand Up @@ -297,9 +295,7 @@ models:
- *blockchain
- *contract_address
- *block_date
- &block_month
name: block_month
description: "UTC event block month"
- *block_month
- &evt_tx_hash
name: evt_tx_hash
description: 'Transaction hash of transfer event'
Expand Down
2 changes: 1 addition & 1 deletion models/balancer/base/balancer_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ FROM (
blockchain,
project,
version,
block_month,
block_date,
block_time,
token_bought_symbol,
Expand All @@ -40,7 +41,6 @@ FROM (
tx_hash,
tx_from,
tx_to,
trace_address,
evt_index
FROM {{ dex_model }}
{% if not loop.last %}
Expand Down
4 changes: 1 addition & 3 deletions models/balancer/base/balancer_v2_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index', 'trace_address'],
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'],
post_hook = '{{ expose_spells(\'["base"]\',
"project",
"balancer_v2",
Expand Down Expand Up @@ -49,7 +49,6 @@ WITH
swap.poolId AS pool_id,
swap_fees.swap_fee_percentage / POWER(10, 18) AS swap_fee,
swap.evt_tx_hash AS tx_hash,
'' AS trace_address,
swap.evt_index
FROM
swap_fees
Expand Down Expand Up @@ -140,7 +139,6 @@ SELECT
dexs.tx_hash,
tx."from" AS tx_from,
tx.to AS tx_to,
dexs.trace_address,
dexs.evt_index
FROM
dexs
Expand Down
8 changes: 2 additions & 6 deletions models/balancer/ethereum/balancer_ethereum_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ models:
- &version
name: version
description: "Version of the project"
- *block_month
- *block_date
- *block_time
- &token_bought_symbol
Expand Down Expand Up @@ -319,9 +320,6 @@ models:
- &tx_to
name: tx_to
description: "transaction.to"
- &trace_address
name: trace_address
description: ""
- *evt_index

- name: balancer_v1_ethereum_trades
Expand All @@ -347,6 +345,7 @@ models:
- *blockchain
- *project
- *version
- *block_month
- *block_date
- *block_time
- *token_bought_symbol
Expand All @@ -367,7 +366,6 @@ models:
- *tx_hash
- *tx_from
- *tx_to
- *trace_address
- *evt_index

- name: balancer_v2_ethereum_trades
Expand All @@ -388,7 +386,6 @@ models:
- version
- tx_hash
- evt_index
- trace_address
- check_dex_seed:
blockchain: ethereum
project: balancer
Expand Down Expand Up @@ -418,7 +415,6 @@ models:
- name: tx_hash
- name: tx_from
- name: tx_to
- name: trace_address
- name: evt_index

- name: balancer_v2_ethereum_liquidity
Expand Down
2 changes: 1 addition & 1 deletion models/balancer/ethereum/balancer_ethereum_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ FROM (
blockchain,
project,
version,
block_month,
block_date,
block_time,
token_bought_symbol,
Expand All @@ -40,7 +41,6 @@ FROM (
tx_hash,
tx_from,
tx_to,
trace_address,
evt_index
FROM {{ dex_model }}
{% if not loop.last %}
Expand Down
6 changes: 3 additions & 3 deletions models/balancer/ethereum/balancer_v1_ethereum_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
schema = 'balancer_v1_ethereum',
tags = ['dunesql'],
alias = alias('trades'),
partition_by = ['block_date'],
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
Expand Down Expand Up @@ -49,6 +49,7 @@ select
'balancer' AS project,
version,
evt_block_time AS block_time,
CAST(date_trunc('month', evt_block_time) AS DATE) AS block_month,
TRY_CAST(date_trunc('day', evt_block_time) AS DATE) AS block_date,
erc20a.symbol AS token_bought_symbol,
erc20b.symbol AS token_sold_symbol,
Expand All @@ -74,8 +75,7 @@ select
evt_tx_hash AS tx_hash,
tx."from" AS tx_from,
tx.to AS tx_to,
evt_index,
CAST(NULL AS VARCHAR(5)) AS trace_address
evt_index
FROM v1 trades
INNER JOIN {{ source('ethereum', 'transactions') }} tx
ON trades.evt_tx_hash = tx.hash
Expand Down
Loading