Skip to content

Commit

Permalink
fix curve view on top of dex.trades and standardize naming standard…
Browse files Browse the repository at this point in the history
… in lineage (duneanalytics#6591)

* standardize to curve naming standard

* fix schema
  • Loading branch information
jeff-dude authored Aug 22, 2024
1 parent 73012b3 commit fa7f244
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{ config(
schema = 'curvefi',
schema = 'curve',
alias = 'trades',
materialized = 'view',
post_hook='{{ expose_spells(blockchains = \'["ethereum","avalanche_c","optimism","fantom","celo"]\',
spell_type = "project",
spell_name = "curvefi",
spell_name = "curve",
contributors = \'["jeff-dude","yulesa","dsalv","Henrystats","msilb7","ilemi","agaperste","tomfutago"]\') }}'
)
}}
Expand Down Expand Up @@ -35,4 +35,4 @@ SELECT blockchain
, tx_to
, evt_index
FROM {{ ref('dex_trades') }}
WHERE project = 'curvefi'
WHERE project = 'curve'
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
version: 2

models:
- name: curvefi_ethereum_pool_details
- name: curve_ethereum_pool_details
meta:
blockchain: ethereum
project: curvefi
project: curve
contributors: [agaperste, yulesa]
config:
tags: ["ethereum", "curvefi", "view"]
tags: ["ethereum", "curve", "view"]
description: >
a dictionary view of pool details for a lot of regular pools on Curve.fi on Ethereum
columns:
Expand Down Expand Up @@ -66,13 +66,13 @@ models:
name: undercoin3
description: "Address for third underlying coin, when applicable"

- name: curvefi_ethereum_view_pools
- name: curve_ethereum_view_pools
meta:
blockchain: ethereum
project: curvefi
project: curve
contributors: [agaperste, yulesa, ilemi, viniabussafi]
config:
tags: ["ethereum", "curvefi", "view_pools", "view"]
tags: ["ethereum", "curve", "view_pools", "view"]
description: >
view details of pools for Curve.fi on Ethereum
columns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(
schema = 'curvefi_ethereum'
schema = 'curve_ethereum'
, alias = 'pool_details'
) }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{ config(
schema = 'curvefi_ethereum',
schema = 'curve_ethereum',
alias = 'view_pools',
materialized='table',
file_format = 'delta',
post_hook='{{ expose_spells(\'["ethereum"]\',
"project",
"curvefi",
"curve",
\'["yulesa", "agaperste", "ilemi", "viniabussafi"]\') }}'
)
}}
Expand All @@ -29,7 +29,7 @@ WITH regular_pools AS (
deposit_contract,
coin3
FROM
{{ ref('curvefi_ethereum_pool_details') }}
{{ ref('curve_ethereum_pool_details') }}
),
regular_pools_deployed AS (
SELECT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2

models:
- name: curvefi_optimism_pools
- name: curve_optimism_pools
meta:
blockchain: optimism
project: curvefi
project: curve
contributors: msilb7
config:
tags: ['optimism','curvefi','curve','dex']
tags: ['optimism','curve','dex']
description: >
A table containing all known pools of curvefi on optimism (i.e. metapool, basicpool). Additional types should be monitored to ensure they're accurately shown.
A table containing all known pools of curve on optimism (i.e. metapool, basicpool). Additional types should be monitored to ensure they're accurately shown.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{ config(
schema = 'curvefi_optimism',
schema = 'curve_optimism',
alias = 'pools',
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['version', 'tokenid', 'token', 'pool'],
post_hook='{{ expose_spells(\'["optimism"]\',
"project",
"curvefi",
"curve",
\'["msilb7"]\') }}'
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ models:
- name: camelot_trades
- name: carbon_defi_trades
- name: clipper_trades
- name: curvefi_trades
- name: curve_trades
- name: defiswap_trades
- name: dfx_trades
- name: dodo_trades
Expand Down
4 changes: 2 additions & 2 deletions dbt_subprojects/dex/models/trades/dex_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ WITH curve AS (
enrich_curve_dex_trades(
base_trades = ref('dex_base_trades')
, filter = "project = 'curve'"
, curve_ethereum = ref('curvefi_ethereum_base_trades')
, curve_optimism = ref('curvefi_optimism_base_trades')
, curve_ethereum = ref('curve_ethereum_base_trades')
, curve_optimism = ref('curve_optimism_base_trades')
, tokens_erc20_model = source('tokens', 'erc20')
)
}}
Expand Down
8 changes: 4 additions & 4 deletions dbt_subprojects/dex/models/trades/ethereum/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -539,15 +539,15 @@ models:
- check_dex_base_trades_seed:
seed_file: ref('xchange_ethereum_base_trades_seed')

- name: curvefi_ethereum_base_trades
- name: curve_ethereum_base_trades
meta:
blockchain: ethereum
sector: dex
project: curvefi
project: curve
contributors: dsalv, yulesa, ilemi, jeff-dude, tomfutago
config:
tags: ['ethereum', 'dex', 'trades', 'curvefi']
description: "Curvefi ethereum base trades"
tags: ['ethereum', 'dex', 'trades', 'curve']
description: "Curve ethereum base trades"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
, ref('clipper_ethereum_base_trades')
, ref('mstable_ethereum_base_trades')
, ref('xchange_ethereum_base_trades')
, ref('curvefi_ethereum_base_trades')
, ref('curve_ethereum_base_trades')
, ref('solidly_v3_ethereum_base_trades')
, ref('swaap_v2_ethereum_base_trades')
] %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{
config(
schema = 'curvefi_ethereum',
schema = 'curve_ethereum',
alias = 'base_trades',
materialized = 'incremental',
file_format = 'delta',
Expand Down Expand Up @@ -51,7 +51,7 @@ WITH dexs AS
, l.tx_hash
, l.index as evt_index
FROM {{ source('ethereum', 'logs') }} l
JOIN {{ ref('curvefi_ethereum_view_pools') }} p
JOIN {{ ref('curve_ethereum_view_pools') }} p
ON l.contract_address = p.pool_address
AND p.version IN ('Factory V1 Meta', 'Factory V1 Plain', 'Regular', 'Factory V1 Stableswap Plain', 'Factory V1 Stableswap Meta', 'Factory V1 Stableswap Plain NG') --note Plain only has TokenExchange.
WHERE l.topic0 IN
Expand Down Expand Up @@ -82,7 +82,7 @@ WITH dexs AS
, l.tx_hash
, l.index as evt_index
FROM {{ source('ethereum', 'logs') }} l
JOIN {{ ref('curvefi_ethereum_view_pools') }} p
JOIN {{ ref('curve_ethereum_view_pools') }} p
ON l.contract_address = p.pool_address
AND (p.version = 'Factory V2' or p.version = 'Factory V2 updated' or p.version = 'Regular' or p.version = 'Factory Twocrypto') --some Regular pools are new and use the below topic instead
WHERE (l.topic0 = 0xb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc98 --TokenExchange
Expand Down
8 changes: 4 additions & 4 deletions dbt_subprojects/dex/models/trades/optimism/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,15 @@ models:
seed_file: ref('rubicon_optimism_base_trades_seed')


- name: curvefi_optimism_base_trades
- name: curve_optimism_base_trades
meta:
blockchain: optimism
sector: dex
project: curvefi
project: curve
contributors: msilb7, tomfutago
config:
tags: ['optimism', 'dex', 'trades', 'curvefi']
description: "Curvefi optimism base trades"
tags: ['optimism', 'dex', 'trades', 'curve']
description: "Curve optimism base trades"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
, ref('openxswap_optimism_base_trades')
, ref('openocean_optimism_base_trades')
, ref('chainhop_optimism_base_trades')
, ref('curvefi_optimism_base_trades')
, ref('curve_optimism_base_trades')
, ref('rubicon_optimism_base_trades')
, ref('gridex_optimism_base_trades')
, ref('solidly_v3_optimism_base_trades')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{
config(
schema = 'curvefi_optimism',
schema = 'curve_optimism',
alias = 'base_trades',
materialized = 'incremental',
file_format = 'delta',
Expand All @@ -10,7 +10,7 @@
)
}}

-- This should depend on 'curvefi_optimism_pools' running first
-- This should depend on 'curve_optimism_pools' running first
-- Original Ref - Dune v1 Abstraction: https://github.com/duneanalytics/spellbook/blob/main/deprecated-dune-v1-abstractions/optimism2/dex/insert_curve.sql
-- Start Time
-- SELECT MIN(evt_block_time) FROM curvefi_optimism.StableSwap_evt_TokenExchange
Expand Down Expand Up @@ -152,10 +152,10 @@ SELECT
AND {{ incremental_predicate('t.evt_block_time') }}
{% endif %}
) cp
INNER JOIN {{ ref('curvefi_optimism_pools') }} ta
INNER JOIN {{ ref('curve_optimism_pools') }} ta
ON cp.project_contract_address = ta.pool
AND cp.bought_id = ta.tokenid
INNER JOIN {{ ref('curvefi_optimism_pools') }} tb
INNER JOIN {{ ref('curve_optimism_pools') }} tb
ON cp.project_contract_address = tb.pool
AND cp.sold_id = tb.tokenid
)
Expand Down

0 comments on commit fa7f244

Please sign in to comment.