From a63ece94ff28f3fcccfcee661c82fe2a14122695 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:23:20 +0200 Subject: [PATCH 01/28] chore: add time series for each pair --- models/camelot/camelot_pair_fee_rates.sql | 52 +++++++++++++++++++ .../camelot/camelot_pair_fee_rates_schema.yml | 38 ++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 models/camelot/camelot_pair_fee_rates.sql create mode 100644 models/camelot/camelot_pair_fee_rates_schema.yml diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql new file mode 100644 index 00000000000..390a50d5fa0 --- /dev/null +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -0,0 +1,52 @@ +{{ config( + schema = 'camelot_arbitrum', -- v2 + v3 + alias = 'pair_fee_rates', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['minute' 'blockchain', 'pair', 'version', 'token0_fee_percentage', 'token1_fee_percentage']) +}} + + +{% set blockchain = "arbitrum" %} +{% set project_start_date = "2022-06-14" %} +{% set v2_fee_precision = "1e5" %} +{% set v2_default_fee = "300" %} -- 0.3% +{% set v3_fee_precision = "1e6" %} +{% set v3_default_fee = "100" %} -- 0.01% + +with + v2_pairs_with_initial_fee_rates as ( + select + date_trunc('minute', evt_block_time) as minute, + pair, + '2' as version, + token0, + {{v2_default_fee}} / {{v2_fee_precision}} as token0_fee_rate, + token1, + {{v2_default_fee}} / {{v2_fee_precision}} as token1_fee_rate + from {{ source("camelot_arbitrum", "CamelotFactory_evt_PairCreated") }} + {% if not is_incremental() %} + where evt_block_time >= timestamp '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + where evt_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} + ), + time_series as ( + select distinct date_trunc('minute', block_time) as minute + from dex.trades + where block_time >= timestamp '{{project_start_date}}' + ), + -- Prepare data structure (1 row for every minute since each pair was created) + time_series_with_pair as ( + select time_series.minute, pair + from v2_pairs_with_initial_fee_rates as pairs + cross join time_series + where time_series.minute >= pairs.minute + ) + +select * +from time_series_with_pair +order by minute desc, pair asc diff --git a/models/camelot/camelot_pair_fee_rates_schema.yml b/models/camelot/camelot_pair_fee_rates_schema.yml new file mode 100644 index 00000000000..9062afbbf7f --- /dev/null +++ b/models/camelot/camelot_pair_fee_rates_schema.yml @@ -0,0 +1,38 @@ +version: 2 + +models: + - name: camelot_pair_fee_rates + meta: + blockchain: arbitrum + sector: dex + project: camelot + contributors: whale_hunter + config: + tags: ["arbitrum", "camelot", "whale_hunter"] + description: > + Camelot fee rates on all chains across all contracts and versions. + columns: + - &blockchain + name: blockchain + description: "Blockchain on which the pair is deployed" + - &minute + name: minute + description: "UTC event block time truncated to the minute mark" + - &pair + name: pair + description: "Pair address" + - &version + name: version + description: "Version of the pair built and deployed by the DEX project" + - &token0 + name: token0 + description: "Address of token0" + - &token0_fee_rate + name: token0_fee_rate + description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" + - &token1 + name: token1 + description: "Address of token1" + - &token1_fee_rate + name: token1_fee_rate + description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0" From ae52deda3e946d7bf16075116fc5814612430684 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:48:58 +0200 Subject: [PATCH 02/28] fix: remove invalid comment syntax --- models/camelot/camelot_pair_fee_rates.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 390a50d5fa0..7ce906d2ad3 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -1,5 +1,5 @@ {{ config( - schema = 'camelot_arbitrum', -- v2 + v3 + schema = 'camelot_arbitrum', alias = 'pair_fee_rates', partition_by = ['block_month'], materialized = 'incremental', @@ -8,7 +8,6 @@ unique_key = ['minute' 'blockchain', 'pair', 'version', 'token0_fee_percentage', 'token1_fee_percentage']) }} - {% set blockchain = "arbitrum" %} {% set project_start_date = "2022-06-14" %} {% set v2_fee_precision = "1e5" %} From 0f1d7bf820457828899155297c32d69cdb25cea9 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:53:46 +0200 Subject: [PATCH 03/28] chore: reformat query file using sqlfmt --- models/camelot/camelot_pair_fee_rates.sql | 33 ++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 7ce906d2ad3..e7a2a6ee00d 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -1,19 +1,28 @@ -{{ config( - schema = 'camelot_arbitrum', - alias = 'pair_fee_rates', - partition_by = ['block_month'], - materialized = 'incremental', - file_format = 'delta', - incremental_strategy = 'merge', - unique_key = ['minute' 'blockchain', 'pair', 'version', 'token0_fee_percentage', 'token1_fee_percentage']) +{{ + config( + schema="camelot_arbitrum", + alias="pair_fee_rates", + partition_by=["block_month"], + materialized="incremental", + file_format="delta", + incremental_strategy="merge", + unique_key=[ + "minute", + "blockchain", + "pair", + "version", + "token0_fee_percentage", + "token1_fee_percentage", + ], + ) }} {% set blockchain = "arbitrum" %} {% set project_start_date = "2022-06-14" %} {% set v2_fee_precision = "1e5" %} -{% set v2_default_fee = "300" %} -- 0.3% +{% set v2_default_fee = "300" %} -- 0.3% {% set v3_fee_precision = "1e6" %} -{% set v3_default_fee = "100" %} -- 0.01% +{% set v3_default_fee = "100" %} -- 0.01% with v2_pairs_with_initial_fee_rates as ( @@ -22,9 +31,9 @@ with pair, '2' as version, token0, - {{v2_default_fee}} / {{v2_fee_precision}} as token0_fee_rate, + {{ v2_default_fee }} / {{ v2_fee_precision }} as token0_fee_rate, token1, - {{v2_default_fee}} / {{v2_fee_precision}} as token1_fee_rate + {{ v2_default_fee }} / {{ v2_fee_precision }} as token1_fee_rate from {{ source("camelot_arbitrum", "CamelotFactory_evt_PairCreated") }} {% if not is_incremental() %} where evt_block_time >= timestamp '{{project_start_date}}' From 094125f2f06bd32aa747461aebbaaab89083c92a Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:20:35 +0200 Subject: [PATCH 04/28] feat: fee rate updates by pair by minute --- models/camelot/camelot_pair_fee_rates.sql | 70 +++++++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index e7a2a6ee00d..73a389ec836 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -2,7 +2,7 @@ config( schema="camelot_arbitrum", alias="pair_fee_rates", - partition_by=["block_month"], + partition_by=["minute"], materialized="incremental", file_format="delta", incremental_strategy="merge", @@ -42,6 +42,46 @@ with where evt_block_time >= date_trunc('day', now() - interval '7' day) {% endif %} ), + v2_directional_fee_rate_updates as ( + select + date_trunc('minute', evt_block_time) as minute, + pair, + version, + token0, + avg(token0feepercent) / {{ v2_fee_precision }} as token0_fee_rate, -- Handle multiple updates per minute + token1, + avg(token1feepercent) / {{ v2_fee_precision }} as token1_fee_rate -- Handle multiple updates per minute + from + {{ source("camelot_arbitrum", "CamelotPair_evt_FeePercentUpdated") }} + as fee_updates + join + v2_pairs_with_initial_fee_rates as pairs + on fee_updates.contract_address = pairs.pair + group by date_trunc('minute', evt_block_time), pair, version, token0, token1 + ), + -- TODO: add v3 fee rate updates + v2_fee_rates_updates as ( + select * + from v2_pairs_with_initial_fee_rates + union all + select * + from v2_directional_fee_rate_updates + ), + -- This approach does not work: Result of sequence function must not have more + -- than 10000 entries + /*time_series as ( + select date_trunc('minute', block_time) as minute + from + ( + select + sequence( + timestamp '{{project_start_date}}' + cast(current_timestamp as timestamp), + interval '1' minute + ) as timestamp_array + ) + cross join unnest(timestamp_array) as t(block_time) + ),*/ time_series as ( select distinct date_trunc('minute', block_time) as minute from dex.trades @@ -53,8 +93,30 @@ with from v2_pairs_with_initial_fee_rates as pairs cross join time_series where time_series.minute >= pairs.minute + ), + pairs_by_minute as ( + select time_series.minute, pair, version, token0, token1 + from v2_pairs_with_initial_fee_rates as pairs + cross join time_series + where time_series.minute >= pairs.minute + ), + pairs_by_minute_with_fee_rates as ( + select + pairs.minute, + pairs.pair, + pairs.version, + pairs.token0, + token0_fee_rate, + pairs.token1, + token1_fee_rate + from pairs_by_minute as pairs + left join + v2_fee_rates_updates + on ( + pairs.minute = v2_fee_rates_updates.minute + and pairs.pair = v2_fee_rates_updates.pair + ) ) - -select * -from time_series_with_pair +select '{{blockchain}}' as blockchain, * +from pairs_by_minute_with_fee_rates order by minute desc, pair asc From d016478a4f02bcf37aeed4028ec8b1869d6fc68e Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:40:27 +0200 Subject: [PATCH 05/28] fix: add sources? --- sources/camelot/arbitrum/camelot_arbitrum_sources.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sources/camelot/arbitrum/camelot_arbitrum_sources.yml diff --git a/sources/camelot/arbitrum/camelot_arbitrum_sources.yml b/sources/camelot/arbitrum/camelot_arbitrum_sources.yml new file mode 100644 index 00000000000..1d28d5c18e2 --- /dev/null +++ b/sources/camelot/arbitrum/camelot_arbitrum_sources.yml @@ -0,0 +1,11 @@ +version: 2 + +sources: + - name: camelot_arbitrum + tables: + - name: CamelotPair_evt_FeePercentUpdated + - name: CamelotFactory_evt_PairCreated + - name: camelot_v3_arbitrum + tables: + - name: AlgebraPool_evt_Fee + - name: AlgebraFactory_evt_Pool From 455c723e4947dbef213410ca8cea10cad3733386 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 20:58:15 +0200 Subject: [PATCH 06/28] fix: remove duplicated sources --- sources/camelot/arbitrum/camelot_arbitrum_sources.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/camelot/arbitrum/camelot_arbitrum_sources.yml b/sources/camelot/arbitrum/camelot_arbitrum_sources.yml index 1d28d5c18e2..e3971f5fafa 100644 --- a/sources/camelot/arbitrum/camelot_arbitrum_sources.yml +++ b/sources/camelot/arbitrum/camelot_arbitrum_sources.yml @@ -4,8 +4,6 @@ sources: - name: camelot_arbitrum tables: - name: CamelotPair_evt_FeePercentUpdated - - name: CamelotFactory_evt_PairCreated - name: camelot_v3_arbitrum tables: - name: AlgebraPool_evt_Fee - - name: AlgebraFactory_evt_Pool From cf771bb35ea2853673c0993575f66d1c07c6c802 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:20:51 +0200 Subject: [PATCH 07/28] feat: fill missing fee rates with last_value() function --- models/camelot/camelot_pair_fee_rates.sql | 50 ++++++++++++++--------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 73a389ec836..b1d2daf34d2 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -99,24 +99,36 @@ with from v2_pairs_with_initial_fee_rates as pairs cross join time_series where time_series.minute >= pairs.minute - ), - pairs_by_minute_with_fee_rates as ( - select - pairs.minute, - pairs.pair, - pairs.version, - pairs.token0, - token0_fee_rate, - pairs.token1, - token1_fee_rate - from pairs_by_minute as pairs - left join - v2_fee_rates_updates - on ( - pairs.minute = v2_fee_rates_updates.minute - and pairs.pair = v2_fee_rates_updates.pair - ) ) -select '{{blockchain}}' as blockchain, * -from pairs_by_minute_with_fee_rates + +select + '{{blockchain}}' as blockchain, + pairs.minute, + pairs.pair, + pairs.version, + pairs.token0, + coalesce( + token0_fee_rate, + last_value(token0_fee_rate) ignore nulls over ( + partition by pairs.pair + order by pairs.minute + rows between unbounded preceding and current row + ) + ) as token0_fee_rate, + pairs.token1, + coalesce( + token1_fee_rate, + last_value(token1_fee_rate) ignore nulls over ( + partition by pairs.pair + order by pairs.minute + rows between unbounded preceding and current row + ) + ) as token1_fee_rate +from pairs_by_minute as pairs +left join + v2_fee_rates_updates + on ( + pairs.minute = v2_fee_rates_updates.minute + and pairs.pair = v2_fee_rates_updates.pair + ) order by minute desc, pair asc From ab440f943cd61d8645c5feed9e095252d5436b3b Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:42:20 +0200 Subject: [PATCH 08/28] feat: add v3 fee rates --- models/camelot/camelot_pair_fee_rates.sql | 57 ++++++++++++++++++----- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index b1d2daf34d2..58840a28541 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -59,13 +59,54 @@ with on fee_updates.contract_address = pairs.pair group by date_trunc('minute', evt_block_time), pair, version, token0, token1 ), - -- TODO: add v3 fee rate updates - v2_fee_rates_updates as ( + v3_pairs_with_initial_fee_rates as ( + select + date_trunc('minute', evt_block_time) as minute, + pool as pair, + '3' as version, + token0, + {{ v3_default_fee }} / {{ v3_fee_precision }} as token0_fee_rate, + token1, + {{ v3_default_fee }} / {{ v3_fee_precision }} as token1_fee_rate + from {{ source("camelot_v3_arbitrum", "AlgebraFactory_evt_Pool") }} + {% if not is_incremental() %} + where evt_block_time >= timestamp '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + where evt_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} + ), + v3_directional_fee_rate_updates as ( + select + date_trunc('minute', evt_block_time) as minute, + pair, + version, + token0, + avg(feezto) / {{ v3_fee_precision }} as token0_fee_rate, -- Handle edge case where pair fees gets changed multiple times per minute + token1, + avg(feeotz) / {{ v3_fee_precision }} as token1_fee_rate -- Handle edge case where pair fees gets changed multiple times per minute + from {{ source("camelot_v3_arbitrum", "AlgebraPool_evt_Fee") }} as fee_updates + join + v3_pairs_with_initial_fee_rates as pairs + on fee_updates.contract_address = pairs.pair + group by date_trunc('minute', evt_block_time), pair, version, token0, token1 + ), + pairs as ( select * from v2_pairs_with_initial_fee_rates union all select * + from v3_pairs_with_initial_fee_rates + ), + fee_rate_updates as ( + select * + from pairs + union all + select * from v2_directional_fee_rate_updates + union all + select * + from v3_directional_fee_rate_updates ), -- This approach does not work: Result of sequence function must not have more -- than 10000 entries @@ -88,12 +129,6 @@ with where block_time >= timestamp '{{project_start_date}}' ), -- Prepare data structure (1 row for every minute since each pair was created) - time_series_with_pair as ( - select time_series.minute, pair - from v2_pairs_with_initial_fee_rates as pairs - cross join time_series - where time_series.minute >= pairs.minute - ), pairs_by_minute as ( select time_series.minute, pair, version, token0, token1 from v2_pairs_with_initial_fee_rates as pairs @@ -126,9 +161,9 @@ select ) as token1_fee_rate from pairs_by_minute as pairs left join - v2_fee_rates_updates + fee_rate_updates on ( - pairs.minute = v2_fee_rates_updates.minute - and pairs.pair = v2_fee_rates_updates.pair + pairs.minute = fee_rate_updates.minute + and pairs.pair = fee_rate_updates.pair ) order by minute desc, pair asc From a55e4bacc3b04aaa8415ac4a5c887f7c2e0183da Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:33:34 +0200 Subject: [PATCH 09/28] fix: partition by blockhain instead of minute --- models/camelot/camelot_pair_fee_rates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 58840a28541..bd056b91294 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -2,7 +2,7 @@ config( schema="camelot_arbitrum", alias="pair_fee_rates", - partition_by=["minute"], + partition_by=["blockchain"], materialized="incremental", file_format="delta", incremental_strategy="merge", From a675c531fcf339f48cfaa55716df55c7b885a536 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:53:46 +0200 Subject: [PATCH 10/28] fix: also include v3 pairs --- models/camelot/camelot_pair_fee_rates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index bd056b91294..ba363d73295 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -131,7 +131,7 @@ with -- Prepare data structure (1 row for every minute since each pair was created) pairs_by_minute as ( select time_series.minute, pair, version, token0, token1 - from v2_pairs_with_initial_fee_rates as pairs + from pairs cross join time_series where time_series.minute >= pairs.minute ) From 4f8e9672c75e4818af3926cb18d0ac5940fbb7ec Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Tue, 30 Apr 2024 23:58:55 +0200 Subject: [PATCH 11/28] perf: only create prices feeds for minutes where camelot trades happened --- models/camelot/camelot_pair_fee_rates.sql | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index ba363d73295..0872f9e2025 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -126,7 +126,11 @@ with time_series as ( select distinct date_trunc('minute', block_time) as minute from dex.trades - where block_time >= timestamp '{{project_start_date}}' + where + block_time >= timestamp '{{project_start_date}}' + and blockchain = '{{blockchain}}' + and project = 'camelot' + ), -- Prepare data structure (1 row for every minute since each pair was created) pairs_by_minute as ( @@ -162,8 +166,5 @@ select from pairs_by_minute as pairs left join fee_rate_updates - on ( - pairs.minute = fee_rate_updates.minute - and pairs.pair = fee_rate_updates.pair - ) + on (pairs.minute = fee_rate_updates.minute and pairs.pair = fee_rate_updates.pair) order by minute desc, pair asc From 7a5346c6e57653b45e5f65b13a1b6ee852be0545 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Wed, 1 May 2024 12:00:21 +0200 Subject: [PATCH 12/28] fix: fix unique keys --- models/camelot/camelot_pair_fee_rates.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 0872f9e2025..773adb99f1e 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -11,8 +11,8 @@ "blockchain", "pair", "version", - "token0_fee_percentage", - "token1_fee_percentage", + "token0_fee_rate", + "token1_fee_rate", ], ) }} From 2cde41c4c061e4f738e000ea54d1436d39bb84b4 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Wed, 1 May 2024 12:01:50 +0200 Subject: [PATCH 13/28] perf: limit scope from all minutes to minutes where activity happened --- models/camelot/camelot_pair_fee_rates.sql | 45 +++++++++++------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 773adb99f1e..be8c4be4fa1 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -108,36 +108,33 @@ with select * from v3_directional_fee_rate_updates ), - -- This approach does not work: Result of sequence function must not have more - -- than 10000 entries - /*time_series as ( - select date_trunc('minute', block_time) as minute - from - ( - select - sequence( - timestamp '{{project_start_date}}' - cast(current_timestamp as timestamp), - interval '1' minute - ) as timestamp_array - ) - cross join unnest(timestamp_array) as t(block_time) - ),*/ - time_series as ( - select distinct date_trunc('minute', block_time) as minute + camelot_pair_trades_by_minute as ( + select distinct + date_trunc('minute', block_time) as minute, project_contract_address as pair from dex.trades where block_time >= timestamp '{{project_start_date}}' and blockchain = '{{blockchain}}' and project = 'camelot' - ), - -- Prepare data structure (1 row for every minute since each pair was created) + -- Prepare data structure (1 row for every minute where pair trades happened + -- and/or fee rates got updated) pairs_by_minute as ( - select time_series.minute, pair, version, token0, token1 - from pairs - cross join time_series - where time_series.minute >= pairs.minute + select distinct minute, pair + from + ( + select minute, pair + from camelot_pair_trades_by_minute + union all + select minute, pair + from fee_rate_updates + ) + ), + -- Add version, token0, token1 columns + pairs_by_minute_with_metadata as ( + select pairs_by_minute.minute, pairs_by_minute.pair, version, token0, token1 + from pairs_by_minute + left join pairs on pairs_by_minute.pair = pairs.pair ) select @@ -163,7 +160,7 @@ select rows between unbounded preceding and current row ) ) as token1_fee_rate -from pairs_by_minute as pairs +from pairs_by_minute_with_metadata as pairs left join fee_rate_updates on (pairs.minute = fee_rate_updates.minute and pairs.pair = fee_rate_updates.pair) From a31d83d314cf7a5b6c31a068f866565d7ea43494 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Wed, 1 May 2024 16:27:07 +0200 Subject: [PATCH 14/28] fix: prevent duplicates --- models/camelot/camelot_pair_fee_rates.sql | 38 ++++++++++++++--------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index be8c4be4fa1..1bc7974e810 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -48,16 +48,15 @@ with pair, version, token0, - avg(token0feepercent) / {{ v2_fee_precision }} as token0_fee_rate, -- Handle multiple updates per minute + token0feepercent / {{ v2_fee_precision }} as token0_fee_rate, -- Handle multiple updates per minute token1, - avg(token1feepercent) / {{ v2_fee_precision }} as token1_fee_rate -- Handle multiple updates per minute + token1feepercent / {{ v2_fee_precision }} as token1_fee_rate -- Handle multiple updates per minute from {{ source("camelot_arbitrum", "CamelotPair_evt_FeePercentUpdated") }} as fee_updates join v2_pairs_with_initial_fee_rates as pairs on fee_updates.contract_address = pairs.pair - group by date_trunc('minute', evt_block_time), pair, version, token0, token1 ), v3_pairs_with_initial_fee_rates as ( select @@ -82,14 +81,13 @@ with pair, version, token0, - avg(feezto) / {{ v3_fee_precision }} as token0_fee_rate, -- Handle edge case where pair fees gets changed multiple times per minute + feezto / {{ v3_fee_precision }} as token0_fee_rate, -- Handle edge case where pair fees gets changed multiple times per minute token1, - avg(feeotz) / {{ v3_fee_precision }} as token1_fee_rate -- Handle edge case where pair fees gets changed multiple times per minute + feeotz / {{ v3_fee_precision }} as token1_fee_rate -- Handle edge case where pair fees gets changed multiple times per minute from {{ source("camelot_v3_arbitrum", "AlgebraPool_evt_Fee") }} as fee_updates join v3_pairs_with_initial_fee_rates as pairs on fee_updates.contract_address = pairs.pair - group by date_trunc('minute', evt_block_time), pair, version, token0, token1 ), pairs as ( select * @@ -99,14 +97,26 @@ with from v3_pairs_with_initial_fee_rates ), fee_rate_updates as ( - select * - from pairs - union all - select * - from v2_directional_fee_rate_updates - union all - select * - from v3_directional_fee_rate_updates + select + minute, + pair, + version, + token0, + avg(token0_fee_rate) as token0_fee_rate, -- Handle edge case where pair fees gets changed multiple times per minute + token1, + avg(token1_fee_rate) as token1_fee_rate -- Handle edge case where pair fees gets changed multiple times per minute + from + ( + select * + from pairs + union all + select * + from v2_directional_fee_rate_updates + union all + select * + from v3_directional_fee_rate_updates + ) + group by minute, pair, version, token0, token1 ), camelot_pair_trades_by_minute as ( select distinct From 71fe1c239ed69707c8ac6d9e05a7ea6078f6e604 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Wed, 1 May 2024 17:14:26 +0200 Subject: [PATCH 15/28] test: remove faulty columns in uniqueness test --- models/camelot/camelot_pair_fee_rates.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 1bc7974e810..8a4657fd3dc 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -10,9 +10,7 @@ "minute", "blockchain", "pair", - "version", - "token0_fee_rate", - "token1_fee_rate", + "version" ], ) }} From b9bd6bcd428f58c1474c7fc85eed9eabf2f29d7e Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Wed, 1 May 2024 17:28:18 +0200 Subject: [PATCH 16/28] fix: move incremental time filters to trades cte --- models/camelot/camelot_pair_fee_rates.sql | 38 ++++++++--------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index 8a4657fd3dc..de44dbddd9f 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -6,12 +6,7 @@ materialized="incremental", file_format="delta", incremental_strategy="merge", - unique_key=[ - "minute", - "blockchain", - "pair", - "version" - ], + unique_key=["minute", "blockchain", "pair", "version"], ) }} @@ -33,12 +28,7 @@ with token1, {{ v2_default_fee }} / {{ v2_fee_precision }} as token1_fee_rate from {{ source("camelot_arbitrum", "CamelotFactory_evt_PairCreated") }} - {% if not is_incremental() %} - where evt_block_time >= timestamp '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - where evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} + ), v2_directional_fee_rate_updates as ( select @@ -46,9 +36,9 @@ with pair, version, token0, - token0feepercent / {{ v2_fee_precision }} as token0_fee_rate, -- Handle multiple updates per minute + token0feepercent / {{ v2_fee_precision }} as token0_fee_rate, token1, - token1feepercent / {{ v2_fee_precision }} as token1_fee_rate -- Handle multiple updates per minute + token1feepercent / {{ v2_fee_precision }} as token1_fee_rate from {{ source("camelot_arbitrum", "CamelotPair_evt_FeePercentUpdated") }} as fee_updates @@ -66,12 +56,6 @@ with token1, {{ v3_default_fee }} / {{ v3_fee_precision }} as token1_fee_rate from {{ source("camelot_v3_arbitrum", "AlgebraFactory_evt_Pool") }} - {% if not is_incremental() %} - where evt_block_time >= timestamp '{{project_start_date}}' - {% endif %} - {% if is_incremental() %} - where evt_block_time >= date_trunc('day', now() - interval '7' day) - {% endif %} ), v3_directional_fee_rate_updates as ( select @@ -79,9 +63,9 @@ with pair, version, token0, - feezto / {{ v3_fee_precision }} as token0_fee_rate, -- Handle edge case where pair fees gets changed multiple times per minute + feezto / {{ v3_fee_precision }} as token0_fee_rate, token1, - feeotz / {{ v3_fee_precision }} as token1_fee_rate -- Handle edge case where pair fees gets changed multiple times per minute + feeotz / {{ v3_fee_precision }} as token1_fee_rate from {{ source("camelot_v3_arbitrum", "AlgebraPool_evt_Fee") }} as fee_updates join v3_pairs_with_initial_fee_rates as pairs @@ -121,9 +105,13 @@ with date_trunc('minute', block_time) as minute, project_contract_address as pair from dex.trades where - block_time >= timestamp '{{project_start_date}}' - and blockchain = '{{blockchain}}' - and project = 'camelot' + blockchain = '{{blockchain}}' and project = 'camelot' + {% if not is_incremental() %} + and block_time >= timestamp '{{project_start_date}}' + {% endif %} + {% if is_incremental() %} + and block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} ), -- Prepare data structure (1 row for every minute where pair trades happened -- and/or fee rates got updated) From a76be6ad8f338923062fb2d39fcdb938f4f50610 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:00:22 +0200 Subject: [PATCH 17/28] chore: remove whitespace --- models/camelot/camelot_pair_fee_rates.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/camelot_pair_fee_rates.sql index de44dbddd9f..6deeeb79f9b 100644 --- a/models/camelot/camelot_pair_fee_rates.sql +++ b/models/camelot/camelot_pair_fee_rates.sql @@ -28,7 +28,6 @@ with token1, {{ v2_default_fee }} / {{ v2_fee_precision }} as token1_fee_rate from {{ source("camelot_arbitrum", "CamelotFactory_evt_PairCreated") }} - ), v2_directional_fee_rate_updates as ( select From 63cf76cc7841f8f05f18bafe871e12e38216372c Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:04:46 +0200 Subject: [PATCH 18/28] chore: move spell to arbitrum folder --- .../camelot_arbitrum_pair_fee_rates.sql} | 0 .../camelot_arbitrum_pair_fee_rates.yml} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename models/camelot/{camelot_pair_fee_rates.sql => arbitrum/camelot_arbitrum_pair_fee_rates.sql} (100%) rename models/camelot/{camelot_pair_fee_rates_schema.yml => arbitrum/camelot_arbitrum_pair_fee_rates.yml} (96%) diff --git a/models/camelot/camelot_pair_fee_rates.sql b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql similarity index 100% rename from models/camelot/camelot_pair_fee_rates.sql rename to models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql diff --git a/models/camelot/camelot_pair_fee_rates_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml similarity index 96% rename from models/camelot/camelot_pair_fee_rates_schema.yml rename to models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml index 9062afbbf7f..ccfd248c23f 100644 --- a/models/camelot/camelot_pair_fee_rates_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: camelot_pair_fee_rates + - name: camelot_arbitrum_pair_fee_rates meta: blockchain: arbitrum sector: dex From a1c42f2d7fb83201401894f60eac73c6f064c1ac Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:10:24 +0200 Subject: [PATCH 19/28] chore: move spell schema to general arbitrum schema file --- .../camelot_arbitrum_pair_fee_rates.yml | 38 ---------------- .../arbitrum/camelot_arbitrum_schema.yml | 44 +++++++++++++++++-- 2 files changed, 40 insertions(+), 42 deletions(-) delete mode 100644 models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml diff --git a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml deleted file mode 100644 index ccfd248c23f..00000000000 --- a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: 2 - -models: - - name: camelot_arbitrum_pair_fee_rates - meta: - blockchain: arbitrum - sector: dex - project: camelot - contributors: whale_hunter - config: - tags: ["arbitrum", "camelot", "whale_hunter"] - description: > - Camelot fee rates on all chains across all contracts and versions. - columns: - - &blockchain - name: blockchain - description: "Blockchain on which the pair is deployed" - - &minute - name: minute - description: "UTC event block time truncated to the minute mark" - - &pair - name: pair - description: "Pair address" - - &version - name: version - description: "Version of the pair built and deployed by the DEX project" - - &token0 - name: token0 - description: "Address of token0" - - &token0_fee_rate - name: token0_fee_rate - description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" - - &token1 - name: token1 - description: "Address of token1" - - &token1_fee_rate - name: token1_fee_rate - description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0" diff --git a/models/camelot/arbitrum/camelot_arbitrum_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_schema.yml index 777f58c7d4c..5deabd7e49f 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_schema.yml @@ -8,7 +8,7 @@ models: project: camelot_v2 contributors: ytoast config: - tags: [ 'arbitrum','dex','trades', 'camelot', 'ytoast'] + tags: ["arbitrum", "dex", "trades", "camelot", "ytoast"] description: > Camelot trades on Arbitrum on a specific contract/version. tests: @@ -102,7 +102,7 @@ models: project: camelot_v3 contributors: whale_hunter config: - tags: [ 'arbitrum','dex','trades', 'camelot', 'whale_hunter'] + tags: ["arbitrum", "dex", "trades", "camelot", "whale_hunter"] description: > Camelot V3 trades on Arbitrum tests: @@ -150,9 +150,9 @@ models: project: camelot contributors: ytoast, whale_hunter config: - tags: ['arbitrum','camelot','trades','dex','ytoast', 'whale_hunter'] + tags: ["arbitrum", "camelot", "trades", "dex", "ytoast", "whale_hunter"] description: > - Camelot trades on Arbitrum + Camelot trades on Arbitrum columns: - *blockchain - *project @@ -176,3 +176,39 @@ models: - *tx_from - *tx_to - *evt_index + + - name: camelot_arbitrum_pair_fee_rates + meta: + blockchain: arbitrum + sector: dex + project: camelot + contributors: whale_hunter + config: + tags: ["arbitrum", "camelot", "whale_hunter"] + description: > + Camelot fee rates over time across all pairs and versions on Arbitrum. + columns: + - &blockchain + name: blockchain + description: "Blockchain on which the pair is deployed" + - &minute + name: minute + description: "UTC event block time truncated to the minute mark" + - &pair + name: pair + description: "Pair address" + - &version + name: version + description: "Version of the pair built and deployed by the DEX project" + - &token0 + name: token0 + description: "Address of token0" + - &token0_fee_rate + name: token0_fee_rate + description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" + - &token1 + name: token1 + description: "Address of token1" + - &token1_fee_rate + name: token1_fee_rate + description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0" From a5be33048fda3d4cea4a5d11e3cd7ddcaeb456fc Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:14:02 +0200 Subject: [PATCH 20/28] fix: use ref syntax for dex.trades --- models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql index 6deeeb79f9b..9adc4f07a63 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql +++ b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql @@ -102,7 +102,7 @@ with camelot_pair_trades_by_minute as ( select distinct date_trunc('minute', block_time) as minute, project_contract_address as pair - from dex.trades + from {{ ref("dex_trades") }} where blockchain = '{{blockchain}}' and project = 'camelot' {% if not is_incremental() %} From 2d63b1f52918910ce63aeedd8761962e31d9a36e Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:15:51 +0200 Subject: [PATCH 21/28] fix: remove partitioning --- models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql index 9adc4f07a63..79e7786b3d0 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql +++ b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql @@ -2,7 +2,6 @@ config( schema="camelot_arbitrum", alias="pair_fee_rates", - partition_by=["blockchain"], materialized="incremental", file_format="delta", incremental_strategy="merge", From 5230dbae3c036647828169fea238753c552b53ab Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:17:07 +0200 Subject: [PATCH 22/28] fix: use incremental_predicate --- models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql index 79e7786b3d0..57eb1e735bd 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql +++ b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql @@ -108,7 +108,7 @@ with and block_time >= timestamp '{{project_start_date}}' {% endif %} {% if is_incremental() %} - and block_time >= date_trunc('day', now() - interval '7' day) + and {{ incremental_predicate("block_time") }} {% endif %} ), -- Prepare data structure (1 row for every minute where pair trades happened From 3f27886dd182c3340547b2c1f7246fa5effc69e8 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:19:56 +0200 Subject: [PATCH 23/28] test: add uniqueness test in schema --- models/camelot/arbitrum/camelot_arbitrum_schema.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models/camelot/arbitrum/camelot_arbitrum_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_schema.yml index 5deabd7e49f..a71d5c26829 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_schema.yml @@ -187,6 +187,13 @@ models: tags: ["arbitrum", "camelot", "whale_hunter"] description: > Camelot fee rates over time across all pairs and versions on Arbitrum. + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - minute + - blockchain + - pair + - version columns: - &blockchain name: blockchain From 6778a3bd05989abfe8ede4f19b8a8ce2e40ccf26 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:23:26 +0200 Subject: [PATCH 24/28] style: use union distinct --- .../arbitrum/camelot_arbitrum_pair_fee_rates.sql | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql index 57eb1e735bd..a0d7e828857 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql +++ b/models/camelot/arbitrum/camelot_arbitrum_pair_fee_rates.sql @@ -114,15 +114,11 @@ with -- Prepare data structure (1 row for every minute where pair trades happened -- and/or fee rates got updated) pairs_by_minute as ( - select distinct minute, pair - from - ( - select minute, pair - from camelot_pair_trades_by_minute - union all - select minute, pair - from fee_rate_updates - ) + select minute, pair + from camelot_pair_trades_by_minute + union distinct + select minute, pair + from fee_rate_updates ), -- Add version, token0, token1 columns pairs_by_minute_with_metadata as ( From 209bcef9b0fd52fc4bb8d698cdc158d52d2be4f4 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:29:14 +0200 Subject: [PATCH 25/28] fix: remove anchors --- .../camelot/arbitrum/camelot_arbitrum_schema.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_schema.yml index a71d5c26829..f8cfe037541 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_schema.yml @@ -195,27 +195,27 @@ models: - pair - version columns: - - &blockchain + - blockchain name: blockchain description: "Blockchain on which the pair is deployed" - - &minute + - minute name: minute description: "UTC event block time truncated to the minute mark" - - &pair + - pair name: pair description: "Pair address" - - &version + - version name: version description: "Version of the pair built and deployed by the DEX project" - - &token0 + - token0 name: token0 description: "Address of token0" - - &token0_fee_rate + - token0_fee_rate name: token0_fee_rate description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" - - &token1 + - token1 name: token1 description: "Address of token1" - - &token1_fee_rate + - token1_fee_rate name: token1_fee_rate description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0" From ad80d3f54c1a28f78d989da7a9e5c512f29ab419 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:38:26 +0200 Subject: [PATCH 26/28] chore: i hate yaml --- .../camelot/arbitrum/camelot_arbitrum_schema.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_schema.yml index f8cfe037541..a5bd73c848b 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_schema.yml @@ -195,27 +195,27 @@ models: - pair - version columns: - - blockchain + - 'blockchain' name: blockchain description: "Blockchain on which the pair is deployed" - - minute + - 'minute' name: minute description: "UTC event block time truncated to the minute mark" - - pair + - 'pair' name: pair description: "Pair address" - - version + - 'version' name: version description: "Version of the pair built and deployed by the DEX project" - - token0 + - 'token0' name: token0 description: "Address of token0" - - token0_fee_rate + - 'token0_fee_rate' name: token0_fee_rate description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" - - token1 + - 'token1' name: token1 description: "Address of token1" - - token1_fee_rate + - 'token1_fee_rate' name: token1_fee_rate description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0" From 280a11b8c3d19e43dfa62686e092ab7b1b3a9a5e Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 2 May 2024 21:43:35 +0200 Subject: [PATCH 27/28] Revert "chore: i hate yaml" This reverts commit ad80d3f54c1a28f78d989da7a9e5c512f29ab419. --- .../camelot/arbitrum/camelot_arbitrum_schema.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_schema.yml index a5bd73c848b..f8cfe037541 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_schema.yml @@ -195,27 +195,27 @@ models: - pair - version columns: - - 'blockchain' + - blockchain name: blockchain description: "Blockchain on which the pair is deployed" - - 'minute' + - minute name: minute description: "UTC event block time truncated to the minute mark" - - 'pair' + - pair name: pair description: "Pair address" - - 'version' + - version name: version description: "Version of the pair built and deployed by the DEX project" - - 'token0' + - token0 name: token0 description: "Address of token0" - - 'token0_fee_rate' + - token0_fee_rate name: token0_fee_rate description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" - - 'token1' + - token1 name: token1 description: "Address of token1" - - 'token1_fee_rate' + - token1_fee_rate name: token1_fee_rate description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0" From 10a24df9a5a1e640471059526614651899350a08 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Fri, 3 May 2024 08:15:46 +0200 Subject: [PATCH 28/28] fix: fix yaml --- .../arbitrum/camelot_arbitrum_schema.yml | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/models/camelot/arbitrum/camelot_arbitrum_schema.yml b/models/camelot/arbitrum/camelot_arbitrum_schema.yml index f8cfe037541..ce88139810d 100644 --- a/models/camelot/arbitrum/camelot_arbitrum_schema.yml +++ b/models/camelot/arbitrum/camelot_arbitrum_schema.yml @@ -195,27 +195,19 @@ models: - pair - version columns: - - blockchain - name: blockchain + - name: blockchain description: "Blockchain on which the pair is deployed" - - minute - name: minute + - name: minute description: "UTC event block time truncated to the minute mark" - - pair - name: pair + - name: pair description: "Pair address" - - version - name: version + - name: version description: "Version of the pair built and deployed by the DEX project" - - token0 - name: token0 + - name: token0 description: "Address of token0" - - token0_fee_rate - name: token0_fee_rate + - name: token0_fee_rate description: "Fee rate as a fraction of 1, applied if token0 gets swapped to token1" - - token1 - name: token1 + - name: token1 description: "Address of token1" - - token1_fee_rate - name: token1_fee_rate + - name: token1_fee_rate description: "Fee rate as a fraction of 1, applied if token1 gets swapped to token0"