diff --git a/dbt_subprojects/dex/models/bot_trades/flokibot/base/flokibot_base_bot_trades.sql b/dbt_subprojects/dex/models/bot_trades/flokibot/base/flokibot_base_bot_trades.sql index 6414dedc79d..dbdbdc01f5d 100644 --- a/dbt_subprojects/dex/models/bot_trades/flokibot/base/flokibot_base_bot_trades.sql +++ b/dbt_subprojects/dex/models/bot_trades/flokibot/base/flokibot_base_bot_trades.sql @@ -40,6 +40,7 @@ with ( to = {{ treasury_fee_wallet_1 }} or to = {{ treasury_fee_wallet_2 }} + or to = {{ aggregator_fee_wallet_1 }} or to = {{ buyback_fee_wallet_1 }} ) and tx_success = true @@ -56,7 +57,9 @@ with where ( varbinary_position(data, {{ aggregator_fee_wallet_1 }}) > 0 + or varbinary_position(data, {{ treasury_fee_wallet_1 }}) > 0 or varbinary_position(data, {{ treasury_fee_wallet_2 }}) > 0 + or varbinary_position(data, {{ buyback_fee_wallet_1 }}) > 0 ) and call_success {% if is_incremental() %} @@ -64,12 +67,28 @@ with {% else %} and call_block_time >= timestamp '{{project_start_date}}' {% endif %} ), + openocean_aggregator_trades as ( + select evt_block_time as block_time, evt_tx_hash as tx_hash + from {{ source('openocean_v2_base', 'OpenOceanExchange_evt_Swapped') }} + where + referrer = {{ aggregator_fee_wallet_1 }} + or referrer = {{ treasury_fee_wallet_1 }} + or referrer = {{ treasury_fee_wallet_2 }} + or referrer = {{ buyback_fee_wallet_1 }} + {% if is_incremental() %} + and {{ incremental_predicate('evt_block_time') }} + {% else %} and evt_block_time >= timestamp '{{project_start_date}}' + {% endif %} + ), trade_transactions as ( select block_time, address, null as tx_hash from bot_contracts union all select block_time, null as address, tx_hash from oneinch_aggregator_trades + union all + select block_time, null as address, tx_hash + from openocean_aggregator_trades ), bot_trades as ( select diff --git a/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql b/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql index 63eade0c94a..0ae3261690a 100644 --- a/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql +++ b/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql @@ -40,8 +40,10 @@ with from {{ source('bnb', 'traces') }} where ( - to = {{ treasury_fee_wallet_1 }} + to = {{ aggregator_fee_wallet_1 }} + or to = {{ treasury_fee_wallet_1 }} or to = {{ treasury_fee_wallet_2 }} + or to = {{ treasury_fee_wallet_3 }} or to = {{ buyback_fee_wallet_1 }} ) and tx_success = true @@ -58,8 +60,10 @@ with where ( varbinary_position(data, {{ aggregator_fee_wallet_1 }}) > 0 + or varbinary_position(data, {{ treasury_fee_wallet_1 }}) > 0 or varbinary_position(data, {{ treasury_fee_wallet_2 }}) > 0 or varbinary_position(data, {{ treasury_fee_wallet_3 }}) > 0 + or varbinary_position(data, {{ buyback_fee_wallet_1 }}) > 0 ) and call_success {% if is_incremental() %} @@ -71,7 +75,11 @@ with select evt_block_time as block_time, evt_tx_hash as tx_hash from {{ source('openocean_v2_bnb', 'OpenOceanExchange_evt_Swapped') }} where - referrer = {{ treasury_fee_wallet_3 }} + referrer = {{ aggregator_fee_wallet_1 }} + OR referrer = {{ treasury_fee_wallet_1 }} + OR referrer = {{ treasury_fee_wallet_2 }} + OR referrer = {{ treasury_fee_wallet_3 }} + OR referrer = {{ buyback_fee_wallet_1 }} {% if is_incremental() %} and {{ incremental_predicate('evt_block_time') }} {% else %} and evt_block_time >= timestamp '{{project_start_date}}' diff --git a/dbt_subprojects/dex/models/bot_trades/flokibot/ethereum/flokibot_ethereum_bot_trades.sql b/dbt_subprojects/dex/models/bot_trades/flokibot/ethereum/flokibot_ethereum_bot_trades.sql index 767d546a6c9..65b05a754c4 100644 --- a/dbt_subprojects/dex/models/bot_trades/flokibot/ethereum/flokibot_ethereum_bot_trades.sql +++ b/dbt_subprojects/dex/models/bot_trades/flokibot/ethereum/flokibot_ethereum_bot_trades.sql @@ -40,6 +40,7 @@ with ( to = {{ treasury_fee_wallet_1 }} or to = {{ treasury_fee_wallet_2 }} + or to = {{ aggregator_fee_wallet_1 }} or to = {{ buyback_fee_wallet_1 }} ) and tx_success = true @@ -56,7 +57,9 @@ with where ( varbinary_position(data, {{ aggregator_fee_wallet_1 }}) > 0 + or varbinary_position(data, {{ treasury_fee_wallet_1 }}) > 0 or varbinary_position(data, {{ treasury_fee_wallet_2 }}) > 0 + or varbinary_position(data, {{ buyback_fee_wallet_1 }}) > 0 ) and call_success {% if is_incremental() %} @@ -68,7 +71,10 @@ with select evt_block_time as block_time, evt_tx_hash as tx_hash from {{ source('openocean_v2_ethereum', 'OpenOceanExchangeProxy_evt_Swapped') }} where - referrer = {{ treasury_fee_wallet_2 }} + referrer = {{ treasury_fee_wallet_1 }} + or referrer = {{ treasury_fee_wallet_2 }} + or referrer = {{ aggregator_fee_wallet_1 }} + or referrer = {{ buyback_fee_wallet_1 }} {% if is_incremental() %} and {{ incremental_predicate('evt_block_time') }} {% else %} and evt_block_time >= timestamp '{{project_start_date}}'