From 52fe09792041e5e9102841ac04a887b0a2390fba Mon Sep 17 00:00:00 2001 From: hildobby Date: Thu, 12 Dec 2024 17:27:48 +0100 Subject: [PATCH 01/32] add invalid pubkeys (#7299) --- .../staking/ethereum/staking_ethereum_flows.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql b/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql index db36a29b6a5..dd6b3a7f087 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql @@ -18,6 +18,19 @@ WITH invalid_pubkeys AS ( , (0x86f473a006c566f1648a82c74cdfbd4a3cb2ea04eb2e0d49ef381ab2562576888554ef3d39e56996f24c804abb489600) , (0x8c69edd7a8e8da5330787952a1ad5075516e6fd4bda1586d62dd64701f7628d5229eb7f929017dea9ae6995f9c69ef5e) , (0x80a29e569e8ced0be1fff42c845a59449aecf8a2503542e4e76763ccc0265e683e2d5d46618cc829349293ed08ff49ff) + , (0xb913a27913c8a74c05cc31c1a690ecad05a59e405bd7c5e8f6eab8e426e041a98b26cf40b04356b4d92ac20a56b7dcae) + , (0x86af099d9134b2994b835cced1fadfb4587dddfc4010470db9d8875cffd9e5a62a197db7d9c0266fb67c5175feb7ef51) + , (0x8107543db1d5c69be127b3eb84c0f7b8157b892482f7e98b85b83d9a6be75e7c24a645df6283d46b16285862530cad77) + , (0x8e05d99c557001d06f8240d46899b829a8cc77ac57b3d16359279cad707cfe5f223a3374987ab73a379ee358dd05d524) + , (0xaebf3fbab24f55df829e2bc939bb987cbdb3edea7d4cb8877e422f1185d03a22f3a0f6449a1d6d1b912ec09ed11f2bb3) + , (0xac3a0887866d5d45555904e2cb35e1b89b4c338c19001b0cc1184c9f95c5a731ccef70dc4c4fed7709c2106042a119c9) + , (0xa03840dd6af6555442e3fc0d62de8dde77970f45175ea9926327372b5c83542f67cdd06e14e1daa44a3ae23e4d8eef52) + , (0x828116d0d2e945f1483ec7c6c135a8e00814588879e9a12a67c42268c339388b6f796f6c858e673f6000f5d028b913da) + , (0x816827749a5194cf8389419e88d87f6786436daaa5546b92c68af015f0b7e17c66f4bb30b18872f3f051c2bc213ecaab) + , (0xa0ab932b24d80a7a96f0fb32ce2aa724625eb090c70cb9c977f0bc5909503629155335be021e58b245e11a77c847a11c) + , (0x8d135f9185f635be5e3d738c835a02d5efab05bc5fa38ce4cb6d02156446aa3cc1ce9cc38576ec519af815dc39d52c81) + , (0x8151e62f956cf1562007d9620fd4e91c029fb43959d1a7d1d2168c2943d65a3ef31764d1cc2d2540fb26ce86efad2ffd) + , (0x9714e943c81d802f3c858f284fff25779818a903c034a3de42da7a2b63ae6632c52b2be0982007e8090d0d334f8cf656) --, (0x00) -- This is a dummy pubkey used to refresh the table ) AS temp_table (pubkey) ) From e093dd3b9ed65c2f330683bf9dcc4f51fe9cce81 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:29:55 +0100 Subject: [PATCH 02/32] feat: add prophetbots solana bot trades spellbook (#7285) * feat: add prophetbots solana bot trades spellbook * fix: sum balance change * chore: fix seed --- .../_sector/dex/bot_trades/solana/_schema.yml | 22 +++ .../solana/dex_solana_bot_trades.sql | 2 + .../prophetbots_solana_bot_trades.sql | 154 ++++++++++++++++++ .../prophetbots_solana_trades_seed.csv | 21 +++ 4 files changed, 199 insertions(+) create mode 100644 dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/prophetbots_solana_bot_trades.sql create mode 100644 dbt_subprojects/solana/seeds/prophetbots/prophetbots_solana_trades_seed.csv diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml index a48042380b2..34b9e61badd 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml @@ -688,3 +688,25 @@ models: - check_bot_trades_seed: seed_file: ref('tradewiz_solana_trades_seed') blockchain: solana + + - name: prophetbots_solana_bot_trades + meta: + blockchain: solana + sector: dex + project: prophetbots + contributors: whale_hunter + config: + tags: ["solana", "dex", "prophetbots", "trades"] + description: > + ProphetBots trades on Solana + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_id + - tx_index + - outer_instruction_index + - inner_instruction_index + - check_bot_trades_seed: + seed_file: ref('prophetbots_solana_trades_seed') + blockchain: solana diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql index 3a46f240904..1432bf2fbb6 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql @@ -36,6 +36,8 @@ , ref('wifbot_solana_bot_trades') , ref('autosnipe_solana_bot_trades') , ref('bitfoot_solana_bot_trades') + , ref('tradewiz_solana_bot_trades') + , ref('prophetbots_solana_bot_trades') ] %} {% for bot in solana_trading_bot %} diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/prophetbots_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/prophetbots_solana_bot_trades.sql new file mode 100644 index 00000000000..c52feb51754 --- /dev/null +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/prophetbots_solana_bot_trades.sql @@ -0,0 +1,154 @@ +{{ config( + alias = 'bot_trades', + schema = 'prophetbots_solana', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] + ) +}} + +{% set project_start_date = '2024-12-02' %} +{% set fee_receiver_1 = '55vkTc7nZoUQM92AfQG7T8bkNKD4TbWeBPRg8KjyUZre' %} -- TeamFeeWallet +{% set fee_receiver_2 = 'Hgckz7Sv8Q5grhLXxDFXGaJD6StPE7Yu8gz611nn1wKS' %} -- RevshareFeeWallet +{% set wsol_token = 'So11111111111111111111111111111111111111112' %} + +WITH + allFeePayments AS ( + SELECT + tx_id, + 'SOL' AS feeTokenType, + sum(balance_change) / 1e9 AS fee_token_amount, + '{{wsol_token}}' AS fee_token_mint_address + FROM + {{ source('solana','account_activity') }} + WHERE + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + AND tx_success + AND balance_change > 0 + AND (address = '{{fee_receiver_1}}' OR address = '{{fee_receiver_2}}') + GROUP BY tx_id + ), + botTrades AS ( + SELECT + trades.block_time, + CAST(date_trunc('day', trades.block_time) AS date) AS block_date, + CAST(date_trunc('month', trades.block_time) AS date) AS block_month, + 'solana' AS blockchain, + amount_usd, + IF( + token_sold_mint_address = '{{wsol_token}}', + 'Buy', + 'Sell' + ) AS type, + token_bought_amount, + token_bought_symbol, + token_bought_mint_address AS token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_mint_address AS token_sold_address, + fee_token_amount * price AS fee_usd, + fee_token_amount, + IF(feeTokenType = 'SOL', 'SOL', symbol) AS fee_token_symbol, + fee_token_mint_address AS fee_token_address, + project, + version, + token_pair, + project_program_id AS project_contract_address, + trader_id AS user, + trades.tx_id, + tx_index, + outer_instruction_index, + inner_instruction_index + FROM + {{ ref('dex_solana_trades') }} AS trades + JOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_id + LEFT JOIN {{ source('prices', 'usd') }} AS feeTokenPrices ON ( + feeTokenPrices.blockchain = 'solana' + AND fee_token_mint_address = toBase58 (feeTokenPrices.contract_address) + AND date_trunc('minute', block_time) = minute + {% if is_incremental() %} + AND {{ incremental_predicate('minute') }} + {% else %} + AND minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + JOIN {{ source('solana','transactions') }} AS transactions ON ( + trades.tx_id = id + {% if is_incremental() %} + AND {{ incremental_predicate('transactions.block_time') }} + {% else %} + AND transactions.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + WHERE + trades.trader_id != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND trades.trader_id != '{{fee_receiver_2}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_2}}' -- Exclude trades signed by FeeWallet + {% if is_incremental() %} + AND {{ incremental_predicate('trades.block_time') }} + {% else %} + AND trades.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ), + highestInnerInstructionIndexForEachTrade AS ( + SELECT + tx_id, + outer_instruction_index, + MAX(inner_instruction_index) AS highestInnerInstructionIndex + FROM + botTrades + GROUP BY + tx_id, + outer_instruction_index + ) +SELECT + block_time, + block_date, + block_month, + 'ProphetBots' as bot, + blockchain, + amount_usd, + type, + token_bought_amount, + token_bought_symbol, + token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_address, + fee_usd, + fee_token_amount, + fee_token_symbol, + fee_token_address, + project, + version, + token_pair, + project_contract_address, + user, + botTrades.tx_id, + tx_index, + botTrades.outer_instruction_index, + COALESCE(inner_instruction_index, 0) AS inner_instruction_index, + IF( + inner_instruction_index = highestInnerInstructionIndex, + true, + false + ) AS is_last_trade_in_transaction +FROM + botTrades + JOIN highestInnerInstructionIndexForEachTrade ON ( + botTrades.tx_id = highestInnerInstructionIndexForEachTrade.tx_id + AND botTrades.outer_instruction_index = highestInnerInstructionIndexForEachTrade.outer_instruction_index + ) +ORDER BY + block_time DESC, + tx_index DESC, + outer_instruction_index DESC, + inner_instruction_index DESC diff --git a/dbt_subprojects/solana/seeds/prophetbots/prophetbots_solana_trades_seed.csv b/dbt_subprojects/solana/seeds/prophetbots/prophetbots_solana_trades_seed.csv new file mode 100644 index 00000000000..a197c0d8b1c --- /dev/null +++ b/dbt_subprojects/solana/seeds/prophetbots/prophetbots_solana_trades_seed.csv @@ -0,0 +1,21 @@ +block_time,block_date,block_month,bot,blockchain,amount_usd,type,token_bought_amount,token_bought_symbol,token_bought_address,token_sold_amount,token_sold_symbol,token_sold_address,fee_usd,fee_token_amount,fee_token_symbol,fee_token_address,project,version,token_pair,project_contract_address,user,tx_id,tx_index,outer_instruction_index,inner_instruction_index,is_last_trade_in_transaction +2024-12-05 16:53:54.000 UTC,2024-12-05,2024-12-01,ProphetBots,solana,11.381475,Buy,208793.948484,Luma,ATnB3fxu6HGjieMtQYJgK4kVVyyZVdVXFigF67pLpump,0.0475,SOL,So11111111111111111111111111111111111111112,0.599025,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Luma,4V1fmQBuj5Zy9qkr5sBqip4UXyirfzVybWgqMGf4hYgB,BxqQCDXfuUJaCw51cQmzXpfYSAt7vKSyHR1WeGtxMfBD,5KYz3YEmBxtqqHrqLvQcrSERc6XDzVntNomZSkmFGwmQ419Jo9L8DHKwxgmWdmpSMLBMhu9XC3CH4z3Bxyvdx1aJ,669,8,0,true +2024-12-05 17:07:09.000 UTC,2024-12-05,2024-12-01,ProphetBots,solana,10.77747650966,Sell,0.045045041,SOL,So11111111111111111111111111111111111111112,533.792777,,ZK6mVzkrj9uqEfyFnCwYCLaW1SJkpdevAujqrpkpump,0.5388735742599999,0.002252251,SOL,So11111111111111111111111111111111111111112,raydium,4,,26e6nfrCFsG2z2i2iePrF2bd2M9SiTKUfPhc5PjRfo85,7dCS2PCbi6xxEcd2UP4WX1vJHtkXuBCRT1PRLVkEJGqR,2VnjsoeVPSVAXpp9KatV7SxEx8apm156x7jupbDH6uMjkRU3jZqFVFsXFekXdXUCFxW1j4ABghWGVAWyz9pUWmD8,127,3,0,true +2024-12-03 16:28:35.000 UTC,2024-12-03,2024-12-01,ProphetBots,solana,10.603900000000001,Buy,134166.826871,빌리,D2HR3Hs8eyD1uj8WKpxw1qwpBchPLMUxwC6PVv3Rpump,0.0475,SOL,So11111111111111111111111111111111111111112,0.5581,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,빌리-SOL,DGY9fRjKYnbRqjyRXcHugjqhv7wScdtt2umsrbU2H3AH,FpzkRxf5DZroddaQUQDDhHuEaksAnyQ4foWEYgLorGUL,3WYyKHY9HEqZxeVDmKC3tw6UiaDNmQZmuE7riX3F1ndzBNn1HfusUBQkTZDhR1zRYYMHD1nSfBSTQop67uofZd9C,415,8,0,true +2024-12-06 15:10:45.000 UTC,2024-12-06,2024-12-01,ProphetBots,solana,11.268424999999999,Buy,129045.650649,KENTA,GupH283BAzrWbYH5WfXpm1DxrDuacDaANWjWzeKjpump,0.0475,SOL,So11111111111111111111111111111111111111112,0.593075,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-KENTA,FG7UJVJyuybqGbss85BvjVnsN8iUjyuWdz9Jn1a6ptbz,7dCS2PCbi6xxEcd2UP4WX1vJHtkXuBCRT1PRLVkEJGqR,5Nqmh81Mf55wqFt8WeiMPmLotbyvjNWCzjuxCU5gdpfuHtVetUjE3rzSi96jbeVHozRvTjtbL8k9aehyATXeH78E,1422,8,0,true +2024-12-09 17:19:41.000 UTC,2024-12-09,2024-12-01,ProphetBots,solana,2.136835,Buy,17473.63405,WOLF,EpPk97NPq4FnEAXnVgmXtfzQMkvsctc67mkhfyN8pump,0.0095,SOL,So11111111111111111111111111111111111111112,0.11246500000000001,0.0005,SOL,So11111111111111111111111111111111111111112,raydium,4,WOLF-SOL,6zWWGQWWvzTRcZTQrMf4NQJsJssVMBvQm3RvLNENdKD9,7dCS2PCbi6xxEcd2UP4WX1vJHtkXuBCRT1PRLVkEJGqR,2u12GokXffjurqYJYX4WQdnKWppBnS37LcvqrKq47Spg4TYh2ZWuso5WLKajpgcqpiEDaN2W6nRimrHZGseXhwmz,1951,9,0,true +2024-12-09 23:26:11.000 UTC,2024-12-09,2024-12-01,ProphetBots,solana,101.63727,Buy,110764.467679,LANA,EsciG7G8g8xVeg9dpy8yJCAavrWNDaykmoMERU8f4Lhv,0.4655,SOL,So11111111111111111111111111111111111111112,5.34933,0.0245,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-LANA,8wont5zeLweXUNPU9ntUDb1nfA87t8THvQ9o6SSPZ5xw,BnLwsxtMBqeVSnvub5WMeys8HH51zjLAgLp6zwZsytE9,4jwVMkhhhsTo8igckryRqhF2LpQGkhzrbZyKzT2F6fvjdyHAL6BNkGNCtwhBFhNVGWFT6YZVzxhq1LGeU7CtnMct,165,9,0,true +2024-12-09 23:26:16.000 UTC,2024-12-09,2024-12-01,ProphetBots,solana,31.113449999999997,Buy,33360.555797,LANA,EsciG7G8g8xVeg9dpy8yJCAavrWNDaykmoMERU8f4Lhv,0.1425,SOL,So11111111111111111111111111111111111111112,1.63755,0.0075,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-LANA,8wont5zeLweXUNPU9ntUDb1nfA87t8THvQ9o6SSPZ5xw,Dn6kWtwBVRWd7rXtCo2718rUfXUTLgoL452BvGSy6a2U,xopZtoxfufcNxRqcToE14p1M6V5C8EPAxTHW1WCCFTNeBXPPmEdPJpEgX84buqiNFxcAoXvbtFMTw6U9yLgqYpv,1980,9,0,true +2024-12-04 03:39:56.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,21.546407681999998,Sell,0.090341332,SOL,So11111111111111111111111111111111111111112,10151.01789,CHAINSAW,7nFvyQr2mwHLjBBECj3MsUxeAbP2D89p7Tx6bQtBpump,1.104251661,0.004629986,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-CHAINSAW,Eg4hFsUc2MwiBumykUe5dnQws37M3P3WzdGFKpQuqp5t,4Q2nw5FenKdW21hbK3n3VYHmwH7fZqnsC4wMQUyRoc35,3JAxGbnUjSRUe2T4jiDfMGmNvaZ9hFojzSexQw1Ki8NKEuPWJRJMCpMcgDfq9R3CyMwywH9JE7RcTfJDHZdA66Bt,1410,3,0,true +2024-12-04 00:56:14.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,169.404,Buy,359939.716201,ASHLEY,B2GoHwUP5zdPb7NhmvS8fVWcW7AkFE3KD3Rns12Mcpe4,0.7125,SOL,So11111111111111111111111111111111111111112,8.915999999999999,0.0375,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-ASHLEY,AFWtVR884tYLm5XXybRnNP8KZz6pavM7dcWmQUZEpwcw,DBRKwVjWGvZNKFnhuZCv6AHZohbDqBd9Am6khga6UcJA,L3N81RscW5kZqJ4HbD9YpB3tZtd3zohhgrtgykjnjv242R8EUMJTYYShe4J7uVsJ6KJBj8u5kDNeT1kzfLmAAbG,1994,9,0,true +2024-12-09 23:26:06.000 UTC,2024-12-09,2024-12-01,ProphetBots,solana,103.7115,Buy,128256.133394,LANA,EsciG7G8g8xVeg9dpy8yJCAavrWNDaykmoMERU8f4Lhv,0.475,SOL,So11111111111111111111111111111111111111112,5.458500000000001,0.025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-LANA,8wont5zeLweXUNPU9ntUDb1nfA87t8THvQ9o6SSPZ5xw,Hc7ntYHQ22bxMdjhcWrBhD539u1S2CWjiQe8vvEqFbdS,5VdcNFNTEG4sf5U7hZywQGjixquR1yGaCfmuhRSUvEr3WR9fw6zA5f3V4qpTPAaK4AkBKmJtqWtj4pfsFNLwG3bs,1480,9,0,true +2024-12-04 17:41:44.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,10.831425,Buy,61992.280328,PABLO,s48HTTPaaPga5AUXaWHXUvQbo1ASmrt3ypparC1pump,0.0475,SOL,So11111111111111111111111111111111111111112,0.570075,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-PABLO,EzjDsgyNcg5QGHVJABaensJ5aeRKpcqa8x9E6CAUdQzA,FZdJmNuuGBDPkd3uevTiPW5tHcMPcCGdVBuu78yCqPCy,Qz4BFs896AYCUCp9SoAebd55yaZTCah4FmP89CWpBZkT1TjrFgYj2uFzQzKxfidAhg5tEBBPiSFwn2brGp6Z2zA,1240,8,0,true +2024-12-04 17:41:35.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,10.831425,Buy,85020.722187,PABLO,s48HTTPaaPga5AUXaWHXUvQbo1ASmrt3ypparC1pump,0.0475,SOL,So11111111111111111111111111111111111111112,0.570075,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-PABLO,EzjDsgyNcg5QGHVJABaensJ5aeRKpcqa8x9E6CAUdQzA,GK1dN6LKFGmS1dhYcjBnLi5zDBThdasCsQ9TwsndNwAX,593qPy9oKsywzormU8Airf7zHmPL3ZvzFMgJTPQjbTEdktatLMKU1rMft9beRQRoGKqegv7d15ccKnqhsje3LxxY,1464,8,0,true +2024-12-05 20:23:43.000 UTC,2024-12-05,2024-12-01,ProphetBots,solana,10.9611,Buy,152919.975464,CHILLKITTY,8sDdRLs9yLcjrKijAQTZTAQAyAHqw7jXsYBF9Ugipump,0.0475,SOL,So11111111111111111111111111111111111111112,0.5769,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-CHILLKITTY,ASR4CbtEQxegoavEVK9qb9eAbrWi5JBfffHRTQrXLrh2,7dCS2PCbi6xxEcd2UP4WX1vJHtkXuBCRT1PRLVkEJGqR,ea3qhrUjuaM4vBLxfWYjgKYbdTKNoAAHegPNNfAz7oe3fLYcwufh1vAcKmnwCyPMLT45qGyZFRur3ucnwVdiSdn,362,9,0,true +2024-12-09 16:21:24.000 UTC,2024-12-09,2024-12-01,ProphetBots,solana,53.430375,Buy,101861.130337,OCUS,F1ivEAt4ZmFhLeRs2LiLG3956TkzqF9YR23rKPMPpump,0.2375,SOL,So11111111111111111111111111111111111111112,2.812125,0.0125,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-OCUS,5FsRuKzNb5xPtUGRC7XSpS4YxeVREwXXgX8QojB2JueL,AVyFf2NNrCjf3b8comQvZ4bpPWZcgJ29pGS8UV5i6QJd,2UCrtGwkpwNQLVAtBHuyqTycki9cWYyRWqBxykUNTFmxi1FxbciNiCtkcjGJ13mEUePxGTDgSYvKA5mFq3wACWLV,369,8,0,true +2024-12-07 17:24:14.000 UTC,2024-12-07,2024-12-01,ProphetBots,solana,114.4085,Buy,180095.388017,$TEREZA,9sqa899GR5UqAusC4nikGKRiVxi2d9MsNJcKLfAKpump,0.475,SOL,So11111111111111111111111111111111111111112,6.0215000000000005,0.025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-$TEREZA,HJNjqkhhsYn27kkT1ULy6rSoVCNG4RaQ5r8VS7xfvWZE,DBRKwVjWGvZNKFnhuZCv6AHZohbDqBd9Am6khga6UcJA,5HADhaBjPjCagLjbHRnoKrGAt1d1k87zedme4idYBLJBV7wYQ491MYyVSYnUjvdFbK6kZLaZVN1EPf5soxupiMH3,1928,8,0,true +2024-12-08 13:05:41.000 UTC,2024-12-08,2024-12-01,ProphetBots,solana,2.23763,Buy,13629.95139,SKICHILL,FTE6GymYs7Q38Sjj3wu6RpAKvGyssMzM3j1wkhjUpump,0.0095,SOL,So11111111111111111111111111111111111111112,0.11777,0.0005,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SKICHILL,Hsqh3aSb9e7azfCVENW4JFPSiQ2668uY2eEYV4SyokTN,6JxrWa9ZDbrB756kTxk3iHQLY3B2p6Jm3AAcEsZUMh2w,41fxVaks6CjNgt21i9UWo9w1xT4rxD5W8Def5pjnnA3f5PDZ9YAcbnGTDNwYYe1pvYqncLAGsUWqSxTAFQsyztVR,932,8,0,true +2024-12-07 17:43:47.000 UTC,2024-12-07,2024-12-01,ProphetBots,solana,12.71012795631,Sell,0.052710687,SOL,So11111111111111111111111111111111111111112,17489.675256,$TEREZA,9sqa899GR5UqAusC4nikGKRiVxi2d9MsNJcKLfAKpump,0.66360471006,0.002752062,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-$TEREZA,HJNjqkhhsYn27kkT1ULy6rSoVCNG4RaQ5r8VS7xfvWZE,BeWmKAhLsMBzqJto1gwFza6UZbDcxFx24Drr9Lzsqiy5,3XXKYQTWoRkqHx2hGBXJpiBCUmvCzmhyXTrzZqo9LdwFVLmUomrudfo9vTKdUXfAz6tuCZoYSj5vwCxFXYC3My6i,186,3,0,true +2024-12-04 19:34:09.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,110.29499999999999,Buy,384509.740192,FranceCTO,5rLBiuBHD3hPY3Lk5NinJWgW8nXJaGwwMBtdoNvxpump,0.475,SOL,So11111111111111111111111111111111111111112,5.805,0.025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-FranceCTO,AD3NnBV7YqdWfuDtHatoGj1GcVgivbzv8jHDmiNZdNWS,5FZJAxJPRLFXwT81NV7c4DkpL83dd1F3MscoAzzekJet,4efvwKH5brMVbame7Uvh35rQEBRV6W3SkyjVk9YWhSBV14NCvU6S6qXsWQnyxk2KY5KRVX6Dja13BLLW1AjwrTbY,219,9,0,true +2024-12-04 03:32:27.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,49.769169999999995,Buy,48037.908896,CHAINSAW,7nFvyQr2mwHLjBBECj3MsUxeAbP2D89p7Tx6bQtBpump,0.209,SOL,So11111111111111111111111111111111111111112,2.61943,0.011,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-CHAINSAW,Eg4hFsUc2MwiBumykUe5dnQws37M3P3WzdGFKpQuqp5t,wv1cUoRGjXqmnH4mMyAkLPMuUpZHUygCENG6f2KBdTx,3nwNf8SKMc7CFgEFpd3mPRvYgRxdvoQYCuyc8tHbi4HXR8XPeG1BJb8QQuhr9HYjrSmJjVsKfHpkVtZZwk54iGYM,1714,9,0,true +2024-12-04 03:32:31.000 UTC,2024-12-04,2024-12-01,ProphetBots,solana,11.311175,Buy,10419.082351,CHAINSAW,7nFvyQr2mwHLjBBECj3MsUxeAbP2D89p7Tx6bQtBpump,0.0475,SOL,So11111111111111111111111111111111111111112,0.595325,0.0025,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-CHAINSAW,Eg4hFsUc2MwiBumykUe5dnQws37M3P3WzdGFKpQuqp5t,BV3wm6iLVJtDTxC57pWLQYgCcrxnHhsaeNLWQjWVUhws,2D64xoBUAktDMyiWzJRpvW21jfhPn9pJGofAqMEPkM55Ks7XqwSH3d98yQ8N8GbPqxQPvtmcgdu19FsWmz9Rfobd,124,9,0,true From d47ed34f544f3aeff6b481e7aeb2462ac10685ba Mon Sep 17 00:00:00 2001 From: clizzard <145153355+clizzard7@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:31:28 +0100 Subject: [PATCH 03/32] add cswap solana (#7297) * add cswap solana * add correct seed * fix seeds --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../_sector/dex/bot_trades/solana/_schema.yml | 23 +++ .../platforms/cswap_solana_bot_trades.sql | 152 ++++++++++++++++++ .../platforms/tradewiz_solana_bot_trades.sql | 2 +- .../seeds/cswap/cswap_solana_trades_seed.csv | 21 +++ .../tradewiz/tradewiz_solana_trades_seed.csv | 40 ++--- 5 files changed, 217 insertions(+), 21 deletions(-) create mode 100644 dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/cswap_solana_bot_trades.sql create mode 100644 dbt_subprojects/solana/seeds/cswap/cswap_solana_trades_seed.csv diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml index 34b9e61badd..bdf23c8aba1 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml @@ -689,6 +689,29 @@ models: seed_file: ref('tradewiz_solana_trades_seed') blockchain: solana + + - name: cswap_solana_bot_trades + meta: + blockchain: solana + sector: dex + project: ChainSwap + contributors: whale_hunter + config: + tags: ["solana", "dex", "cswap", "trades"] + description: > + ChainSwap trades on Solana + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_id + - tx_index + - outer_instruction_index + - inner_instruction_index + - check_bot_trades_seed: + seed_file: ref('cswap_solana_trades_seed') + blockchain: solana + - name: prophetbots_solana_bot_trades meta: blockchain: solana diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/cswap_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/cswap_solana_bot_trades.sql new file mode 100644 index 00000000000..22c84a1da47 --- /dev/null +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/cswap_solana_bot_trades.sql @@ -0,0 +1,152 @@ +{{ config( + alias = 'bot_trades', + schema = 'cswap', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] + ) +}} + +{% set project_start_date = '2024-12-06' %} +{% set fee_receiver_1 = 'CSWAP5SpPcVjvpsA1H2n2HjNjMsRaPnZuX8H8bVJN5wy' %} +{% set wsol_token = 'So11111111111111111111111111111111111111112' %} + +WITH + allFeePayments AS ( + SELECT + tx_id, + 'SOL' AS feeTokenType, + balance_change / 1e9 AS fee_token_amount, + '{{wsol_token}}' AS fee_token_mint_address + FROM + {{ source('solana','account_activity') }} + WHERE + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + AND tx_success + AND balance_change > 0 + AND ( + address = '{{fee_receiver_1}}' + ) + ), + botTrades AS ( + SELECT + trades.block_time, + CAST(date_trunc('day', trades.block_time) AS date) AS block_date, + CAST(date_trunc('month', trades.block_time) AS date) AS block_month, + 'solana' AS blockchain, + amount_usd, + IF( + token_sold_mint_address = '{{wsol_token}}', + 'Buy', + 'Sell' + ) AS type, + token_bought_amount, + token_bought_symbol, + token_bought_mint_address AS token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_mint_address AS token_sold_address, + fee_token_amount * price AS fee_usd, + fee_token_amount, + IF(feeTokenType = 'SOL', 'SOL', symbol) AS fee_token_symbol, + fee_token_mint_address AS fee_token_address, + project, + version, + token_pair, + project_program_id AS project_contract_address, + trader_id AS user, + trades.tx_id, + tx_index, + outer_instruction_index, + inner_instruction_index + FROM + {{ ref('dex_solana_trades') }} AS trades + JOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_id + LEFT JOIN {{ source('prices', 'usd') }} AS feeTokenPrices ON ( + feeTokenPrices.blockchain = 'solana' + AND fee_token_mint_address = toBase58 (feeTokenPrices.contract_address) + AND date_trunc('minute', block_time) = minute + {% if is_incremental() %} + AND {{ incremental_predicate('minute') }} + {% else %} + AND minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + JOIN {{ source('solana','transactions') }} AS transactions ON ( + trades.tx_id = id + {% if is_incremental() %} + AND {{ incremental_predicate('transactions.block_time') }} + {% else %} + AND transactions.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + WHERE + trades.trader_id != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + {% if is_incremental() %} + AND {{ incremental_predicate('trades.block_time') }} + {% else %} + AND trades.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ), + highestInnerInstructionIndexForEachTrade AS ( + SELECT + tx_id, + outer_instruction_index, + MAX(inner_instruction_index) AS highestInnerInstructionIndex + FROM + botTrades + GROUP BY + tx_id, + outer_instruction_index + ) +SELECT + block_time, + block_date, + block_month, + 'ChainSwap' as bot, + blockchain, + amount_usd, + type, + token_bought_amount, + token_bought_symbol, + token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_address, + fee_usd, + fee_token_amount, + fee_token_symbol, + fee_token_address, + project, + version, + token_pair, + project_contract_address, + user, + botTrades.tx_id, + tx_index, + botTrades.outer_instruction_index, + COALESCE(inner_instruction_index, 0) AS inner_instruction_index, + IF( + inner_instruction_index = highestInnerInstructionIndex, + true, + false + ) AS is_last_trade_in_transaction +FROM + botTrades + JOIN highestInnerInstructionIndexForEachTrade ON ( + botTrades.tx_id = highestInnerInstructionIndexForEachTrade.tx_id + AND botTrades.outer_instruction_index = highestInnerInstructionIndexForEachTrade.outer_instruction_index + ) +ORDER BY + block_time DESC, + tx_index DESC, + outer_instruction_index DESC, + inner_instruction_index DESC diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/tradewiz_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/tradewiz_solana_bot_trades.sql index 526385d028c..5227bed50b8 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/tradewiz_solana_bot_trades.sql +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/tradewiz_solana_bot_trades.sql @@ -111,7 +111,7 @@ SELECT block_time, block_date, block_month, - 'Solgun' as bot, + 'Tradewiz' as bot, blockchain, amount_usd, type, diff --git a/dbt_subprojects/solana/seeds/cswap/cswap_solana_trades_seed.csv b/dbt_subprojects/solana/seeds/cswap/cswap_solana_trades_seed.csv new file mode 100644 index 00000000000..012bac505d7 --- /dev/null +++ b/dbt_subprojects/solana/seeds/cswap/cswap_solana_trades_seed.csv @@ -0,0 +1,21 @@ +block_time,block_date,block_month,bot,blockchain,amount_usd,type,token_bought_amount,token_bought_symbol,token_bought_address,token_sold_amount,token_sold_symbol,token_sold_address,fee_usd,fee_token_amount,fee_token_symbol,fee_token_address,project,version,token_pair,project_contract_address,user,tx_id,tx_index,outer_instruction_index,inner_instruction_index,is_last_trade_in_transaction +2024-12-08 17:53:40.000 UTC,2024-12-08,2024-12-01,ChainSwap,solana,236.41,Buy,5166634.046655,RON,ArVrcEbaLhZPdvfxa4PdXBykhSUTDbKYqKfd6m5DPVvd,1,SOL,So11111111111111111111111111111111111111112,0.70923,0.003,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-RON,6w6ogSTWjpxwNvtBFgNGMyYguxdbxp13yEX2oLtozS9T,FvQ614xsLAfD8TxSszCydwhRJzGECDQBgY1oXaeWPk9P,2vmFMnKPV7SQMAPMuTX6cRsmwiRRYrk3vZAaJ4uM1A6K2T3sMsoLakb6zF6sXQW5TnMF1TYQxvesyb8rPJzSSbT3,2693,4,1,true +2024-12-08 00:56:13.000 UTC,2024-12-08,2024-12-01,ChainSwap,solana,631.0501005872401,Sell,2.638389918,SOL,So11111111111111111111111111111111111111112,101040.940582,LIMITLESS,44o1iDPGuzHxQgDrPE3HRb2WXwGLsBsY7yMttX47pump,2.04393445538,0.008545591,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-LIMITLESS,14YuCFitrqHrPTzP1hP5fF1pQpnSoQNVucRnzJbYyMB7,8uciVcc4zoGmEQf1ys1ztrLMwPZiBNfGshG2BNrBjQGk,2QZ9boZwkssx1KPm1MDnNaL1pSZk8bawqShH2ACe6YmzJboaAjGFzk6ad8SSWFdb57pSqEhzQzgeEirWQDsimW8k,938,2,1,true +2024-12-09 22:47:21.000 UTC,2024-12-09,2024-12-01,ChainSwap,solana,3.4000866542,Sell,0.01588306,SOL,So11111111111111111111111111111111111111112,32.65,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,0.01081438826,0.000050518,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRIFFAIN,CpsMssqi3P9VMvNqxrdWVbSBCwyUHbGgNcrw7MorBq3g,DoKCDiii9JAevz8fW9PM8gagkuuHGSaAzMBsfZarNhUt,mTcDV84pRnFFu2JZJpFDjWRdDdotiEoKTu82yu6HeGZbouVy6UDkDtJetkn5JauBmmb5pi7DaMo8Bk7e888w5Nu,1771,2,1,true +2024-12-07 10:11:03.000 UTC,2024-12-07,2024-12-01,ChainSwap,solana,2.39099107707,Sell,0.010026381,SOL,So11111111111111111111111111111111111111112,827830824.8232,SHIKOKU,5Jng6jkLKU1o8BNrCzTEMXMFvPjNJZTpdWR3Hq4RHJb6,0.02362689219,0.000099077,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SHIKOKU,FyQuZLz6LLJxKhSwXkMpZ5Po6G8bcRv8Ub2s3paU74pC,oN3T43asj7TyEViAgQaFdMmmsScScDNZ6C6V4UeuhXA,LFWJiVrsVbktPzNg2soY96n8NShX6eAae2UP8oK8Fo7BuqbCUX4hwNVfkPH9VYbrzAmBnjAQbGknCz6UvDANe8a,1826,2,1,true +2024-12-08 01:44:03.000 UTC,2024-12-08,2024-12-01,ChainSwap,solana,237.46446197876,Sell,0.994324018,SOL,So11111111111111111111111111111111111111112,2665.625316,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,0.71856949706,0.003008833,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRIFFAIN,CpsMssqi3P9VMvNqxrdWVbSBCwyUHbGgNcrw7MorBq3g,DkGiBk9TAUUm42rDcPWQqRstMWB4pRvN9WxuBm91WX98,5ZNNzu8kj4QFjSYXVKpTdrztYYd2UHW1dAsDtVc8g3P9Ra2fpS9nzTVthvhXcYw3NVttQ4enHcMCGJpcQd6HFYJ2,49,2,1,true +2024-12-08 13:54:49.000 UTC,2024-12-08,2024-12-01,ChainSwap,solana,134.775385344,Buy,10618804.080094,KITTY,7TgVhQwYofgkUHrKqyX6NWc4iVb2nnG87xxU3M3pump,0.568672512,SOL,So11111111111111111111111111111111111111112,0.3555,0.0015,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-KITTY,89WiiZ66AfCsEckK4YhLwxVYZhAPmDcaePkzdnXeHbBP,Ex9E6pWf8CXyUby5TubhGkxuCk7NZnLJhyD65D5qidvq,2XkLYLPszv9nWBzYbY2jepTQ4JT2bkcvpkNPSKhyAj7FTfbAoj8tLABwmRwU7ZM2PHW2vyM3o8v6hr6BboYxcSpF,1369,2,4,true +2024-12-10 23:42:51.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,642.24,Buy,2557653.017448,NORM,H4WLmYEc1Q9Fk8cbvieqiqc8ALbYA5W2bhbKdkJE2bth,3,SOL,So11111111111111111111111111111111111111112,1.92672,0.009,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-NORM,CYSLB654GfgYE1gQBe9TNbnyZB2kKFTPd5bweM5vLBGw,A9wB4BddvvsKnGM3BTJSWjhQ4ibs7piBtCXd5bdhJZVY,37Jpm6RfG9joRi9KtGKNF91rnEMHrocD128SRGaNmPkBCpVT6cwRkpDE9Yv3vhq1DbPH6sVbabn4mrr9xE8gxxEq,1747,5,1,true +2024-12-10 01:33:26.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,10770.450408761199,Sell,49.14871958,SOL,So11111111111111111111111111111111111111112,81469.171522,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,32.43617846748,0.148015782,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRIFFAIN,CpsMssqi3P9VMvNqxrdWVbSBCwyUHbGgNcrw7MorBq3g,88XssAnXed7S4JGS4CFbR7isBtTUbk7CWRtWEbiwCWYX,4FtUdRsx4FKj5kWJDWxsjL3vakYEcWrUUdC2UwS9rcGCyv452zqhJTPF3wBURsYeq6FiHVuBzSXsFfNZqwyoRUEk,98,2,1,true +2024-12-10 22:21:04.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,105.91416678052,Sell,0.497062919,SOL,So11111111111111111111111111111111111111112,546.471895,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,0.32020319996,0.001502737,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRIFFAIN,CpsMssqi3P9VMvNqxrdWVbSBCwyUHbGgNcrw7MorBq3g,BYCcoE7DoBN8e3SijRC7rhTnjeGsWPZxNJYb3pYY6EiG,3v7TwmmYUrkuETW5f7MciiP5rdQSXVnpigson5hZEgwi2ELRasKMkwowr7JnrJ1waC6hv3grfLDjgkAfJtzBEEaj,2187,2,1,true +2024-12-11 04:55:07.000 UTC,2024-12-11,2024-12-01,ChainSwap,solana,24.38229109238,Sell,0.111344831,SOL,So11111111111111111111111111111111111111112,1142698.17840853,G.O.A.T,9ko9A8Fc7yRTrYxmtQDAk36WAeLtczrsPmaf5yH1RPTS,0.07536503271999999,0.000344164,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-G.O.A.T,3dzEMpvw7MZm8vq9nKKqxnc7fCUpSqUQEAbRweZQArmR,8igyY1CBBC8VnkcXjPtdMQmfdtc1uTQ7Xsd6tiuj7bgv,ySQVVBRdFDEUYJfT6Ed2kQKNTXHy4yWrYzcPmgm5h4F3yuSHbiSyLE2BownRAe6S8NeZsDJ1AGG3Q5by2EoCpZq,1556,4,1,true +2024-12-09 22:13:27.000 UTC,2024-12-09,2024-12-01,ChainSwap,solana,542.30566942638,Buy,7730247.791584,Mario Bros,Hbdb8rSS7NdpDeuVx5NYUyR9VMKPAmo2nVim2pyDpump,2.508119829,SOL,So11111111111111111111111111111111111111112,1.29732,0.006,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Mario Bros,qc2ZDKTXxJ26EWEQKGWPJdfUP5UotNjzt7gNyQvogu5,2v7nLcvVde3fXASST46xX8u1qdcffAXXGtJLZfKD29sH,3uWWHnQSKPwtbPLBEDjdHCcUkvQa6gFvC6RQHcyEC91cMJgB9Bncr4GduNPvmJV3PW3MAA31AKJ7V94iYa359Sqf,2225,1,4,true +2024-12-08 17:03:15.000 UTC,2024-12-08,2024-12-01,ChainSwap,solana,117.94,Buy,890505.749209,Luffy,9yP5HSq8HK3aN49D8GwJoYbuFGcKnRuvQNmYxrRJpump,0.5,SOL,So11111111111111111111111111111111111111112,0.35382,0.0015,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Luffy,tz5JL88F5tvAUPJE9RbShYB8z16LcpqHL4emmJw6ten,FV3Tt7JtCQ7w6WKsbZxP5r2AN9sX7LCjZroWMJpoKjp3,4g2bQ2m8L8HpJDts6MiSs8sQdH6okXXJPCaEmNhzTj9P3UnmL2RJpx9C9v1txXfaEZGMu7RKY8zyax2VbFz4NmnH,508,5,1,true +2024-12-10 16:03:14.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,403.94903408934,Sell,1.953426346,SOL,So11111111111111111111111111111111111111112,4982686.673278,Kawaī,csdwe8ZRjbchjCWdeSZ8GSNw4XWbRzmCewzD9dUpump,1.3224425222099998,0.006395099,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Kawaī,4VZSRvRECysU1R75kkHqeqnGzgqcBKsL9MaQ5fbgR56E,8BXTUKqo2nws3HJ5SwQHzSH6bECyP5mMyPvj2MuHJdef,8Sd4aEp14mkpVvUW5bdySG2Ee2a9K86pWjyJgw3hKTchE4H1WvjcCjVuhTihHDSGxbHREgpRTFXkmtZuK2menvC,2154,2,1,true +2024-12-07 15:50:02.000 UTC,2024-12-07,2024-12-01,ChainSwap,solana,234.91497195601,Sell,0.978771601,SOL,So11111111111111111111111111111111111111112,115245.068956,VIRGIN,2MtX583jbXXKnE4BvghsEi4ud3uQJEkJVnt7oWc3pump,0.7168522676,0.00298676,SOL,So11111111111111111111111111111111111111112,raydium,4,VIRGIN-SOL,3CLYXZAcAFBjqAfAwxeSUrpbx2ACZyfnGjZ1WvZ1utYj,88XssAnXed7S4JGS4CFbR7isBtTUbk7CWRtWEbiwCWYX,2v49qpLkXkUySc4uyGLQWWQ3TqPsTDTT7zCQLxNQdRWbWWQJEdCJoUaj6jVK4gUAtu9JwWzLv5qrjkw5yT2xx8XU,265,2,1,true +2024-12-10 00:31:19.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,213.85821178848,Sell,0.977771634,SOL,So11111111111111111111111111111111111111112,1731.008892,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,0.65331532768,0.002986994,SOL,So11111111111111111111111111111111111111112,meteora,2,SOL-GRIFFAIN,EN5ji4DsJCaLNXzkJVEX9sgsN6XMxq5ssLkCxgiDJiM9,GPqcYH2yP1w4LPpQN65mDcU5CdBbRmS4QvVAJP8Lo4x7,4DNXtgt1kp3UheG49gSQcfwSNnXuRo4jV1qXZ2azpLznwYUkwos5AH1x3EfPiMcCfguh9CnTkUL1qUzihcnMiuF9,535,2,1,true +2024-12-10 11:43:17.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,3143.608268642,Sell,14.5544158,SOL,So11111111111111111111111111111111111111112,1212813.794696,yumi,FhbqJtDE5XXk9Netjvrx5nhmnXxFRAS9eoGLwMi2pump,16.44982237489,0.076160111,SOL,So11111111111111111111111111111111111111112,meteora,2,yumi-SOL,5SeoX3xAe7F9xxDxXVLvRyRtYfSi8yaB5NakpJt7DHEL,DkGiBk9TAUUm42rDcPWQqRstMWB4pRvN9WxuBm91WX98,1NfcHQvucLuAGsfTpz1cM3UG8WPL4RCe3BCqk2AzXf6KbFpqHC6q1Ez1UQbD3ksvAQL3dKQ8MsFJyWp1KApqE3i,642,2,2,false +2024-12-10 03:05:28.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,851.474647641,Sell,3.997533557,SOL,So11111111111111111111111111111111111111112,5151.222836,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,2.585950995,0.012140615,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRIFFAIN,CpsMssqi3P9VMvNqxrdWVbSBCwyUHbGgNcrw7MorBq3g,BYCcoE7DoBN8e3SijRC7rhTnjeGsWPZxNJYb3pYY6EiG,3YpZyrUnMJYW28pVc6nfwVbMHXfUeD7iAgt2nJ5JmUxURT4urXGrxtsJyamkfU4cgeAgv18QPCteguiEYAxixN4d,1867,2,1,true +2024-12-10 01:05:46.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,6466.025441846759,Sell,29.630764558,SOL,So11111111111111111111111111111111111111112,49584.452082,GRIFFAIN,KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP,19.09584824328,0.087507324,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRIFFAIN,CpsMssqi3P9VMvNqxrdWVbSBCwyUHbGgNcrw7MorBq3g,DkGiBk9TAUUm42rDcPWQqRstMWB4pRvN9WxuBm91WX98,vsBxekU3cg4LGUYs4vRCSsdVzdKZUWQZEMZzr6ooXcwTVuCnoK66xjUnyb7m4zZm5DfMpPSrgEgdVAcwZ46Tq5Z,990,2,1,true +2024-12-10 18:46:45.000 UTC,2024-12-10,2024-12-01,ChainSwap,solana,220.71725077265,Sell,1.047990365,SOL,So11111111111111111111111111111111111111112,60094.458308,yumi,FhbqJtDE5XXk9Netjvrx5nhmnXxFRAS9eoGLwMi2pump,0.63149955291,0.002998431,SOL,So11111111111111111111111111111111111111112,raydium,4,yumi-SOL,EvWxeXEmTgMVXLfqcugKvCDQ5yZPGHt8iq9N6ELWKf6,Cq6FCvEqBmfsSa89377vNH1H1b7NDJmqNZMvAw74HRYS,2w59JeJdbzDfABXkmC3ZSohbEgnssKGGhXqVtpWC3FWoVGiqv752SpSeatUZTVvSSNhr8zVbyVRHYEaGpsBvD8Gv,1074,2,1,true +2024-12-09 17:28:52.000 UTC,2024-12-09,2024-12-01,ChainSwap,solana,673.83,Buy,541278.944723,POLYBOT,CXLsXyGNRznVaJRKCcv7Cne3sbxGRBy4BdQMo3Tjpump,3,SOL,So11111111111111111111111111111111111111112,2.02149,0.009,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-POLYBOT,69hWrBg3g86BmRhJ8zAZGz2zP53CyKHCaBoFvqkarqm7,DkGiBk9TAUUm42rDcPWQqRstMWB4pRvN9WxuBm91WX98,4xzRFQPbqB3wJZPNgJLpqT91gJ5a2y1Yh4HUzwzhUr2NzNM7jhZhSWWSCyWYMBoFPBzy1cRFUuPC5TX1CHZ3Rs8D,2003,4,1,true diff --git a/dbt_subprojects/solana/seeds/tradewiz/tradewiz_solana_trades_seed.csv b/dbt_subprojects/solana/seeds/tradewiz/tradewiz_solana_trades_seed.csv index 2525f27cce6..b3d981bede7 100644 --- a/dbt_subprojects/solana/seeds/tradewiz/tradewiz_solana_trades_seed.csv +++ b/dbt_subprojects/solana/seeds/tradewiz/tradewiz_solana_trades_seed.csv @@ -1,21 +1,21 @@ block_time,block_date,block_month,bot,blockchain,amount_usd,type,token_bought_amount,token_bought_symbol,token_bought_address,token_sold_amount,token_sold_symbol,token_sold_address,fee_usd,fee_token_amount,fee_token_symbol,fee_token_address,project,version,token_pair,project_contract_address,user,tx_id,tx_index,outer_instruction_index,inner_instruction_index,is_last_trade_in_transaction -2024-12-03 03:41:57.000 UTC,2024-12-03,2024-12-01,Solgun,solana,5.10029703516,Buy,130284.164414,VIBE,AB4oELjeXLyeV3t3evMgq3zXrxXAJ1WdRy9qgfinH1oq,0.022402148,SOL,So11111111111111111111111111111111111111112,0.04940438999999999,0.000217,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,VIBE-SOL,AKtxTJHHtyDTBUerXQhWQSY4L8oBreBqPHkiPbkyoL3s,8dRLn2NMHsN7Fu1nxCbfQDujQ4wyPaqmnfqHyfVvBnmj,5xYqUmnvW78WSa1VL9G3H2fkRcBbaGRfr95iDTH9JWNTAheT7pnNguneMDzkge9Bqs5KTK8boRHKHPupBtW4hBL1,1139,7,4,true -2024-12-07 15:17:10.000 UTC,2024-12-07,2024-12-01,Solgun,solana,2.1149015703,Sell,0.008739985,SOL,So11111111111111111111111111111111111111112,312509.10149,CELLAI3,5q4maTRYm1ZPuFZqFzwYRJ7jAA5xkprmndJdGHUnpjwT,0.0209373195,0.000086525,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-CELLAI3,ARUgR3UzG2KCXWAXQNSHdPuuZ5Spmmm8vTENUn3UK4HU,F6coj9TDxLDw1wSFYsQMPmA2iPYhNxu17qBSEZ8vZuDm,5769zBmZrWqPGqWU9QA2LH5CrjPnJTWePmtC8bgTtciupjiLNuNaYuLS3FEkN7eThaQj57NcTc1Hz39VnkdtDgbB,2030,3,2,true -2024-12-06 19:47:39.000 UTC,2024-12-06,2024-12-01,Solgun,solana,5.72664660432,Buy,103332.858778,PAWBLEMS,4fLAZZCA3Mrbj6Wa9PkTUHfUWu3JE2RqGHvDrXiMpump,0.023872964,SOL,So11111111111111111111111111111111111111112,0.047976000000000005,0.0002,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-PAWBLEMS,kLCF7gruvuMfBLvwSL4XZQK2ENKYKm97LFuLAKkxC5b,DksfCf1U4arH6eq9KJJJtHDiYypi3gzwnxbup2266uae,szuK2Sdz9ps9Go88t1FVjFRezggBdh1RqWETVD8voF78mJm97H3pnt6EYrN9aUmYHUmGAvKfrTs46tJfC2F1GCt,1583,5,4,true -2024-12-06 11:48:01.000 UTC,2024-12-06,2024-12-01,Solgun,solana,65.36809866600001,Sell,0.279350849,SOL,So11111111111111111111111111111111111111112,371324.880761,HYPHAL,2gsxJ1fyLi3kzvjQx8Wd8y323Ptigzj9ti54grHkpump,0.658593702,0.002814503,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-HYPHAL,2YeDSYdr9mMvEtiWskGvHbt6WSZ6wHW9xGi8DuB9GjdJ,Ed1rA4YjgtJMExjQ6sjWrEEj7xaeL6f4yvT39sm8fZo8,3VN42UsvXsxqnUDiTDQaHhrWmGCwoWnfJJWyPbz7nvja5n9EZohisb7ZR4ojD3LzDG8rquC74kJY3Z3bHac6FYqh,64,4,0,true -2024-12-03 06:01:15.000 UTC,2024-12-03,2024-12-01,Solgun,solana,12.54215028618,Sell,0.055040814,SOL,So11111111111111111111111111111111111111112,434296.831722,Pooch,csrNabqJ6eKoueCiVxGWTTbN3Bri1MhwbwoCN2Wpump,0.12432632773999999,0.000545602,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Pooch,H82eA83r3Djyt1s4T6213puNzM1As8w2tCSYjgv6kjFz,66gfZJ3yVCxhRY3VvSKxTYhrW4HAUvhbVFRCRrgoATkE,3hhXSyxnoA3U1eYsY2P8EjAqen3mWBscPoPK4pudmobfENN1VKCzAHKPaBQRk4S98W9fB41tm4MgUJ1NE4F4ZjNt,413,3,2,true -2024-12-02 18:50:09.000 UTC,2024-12-02,2024-12-01,Solgun,solana,33.5145,Buy,1090000.477547,FWILL,8aMmdyEH97qmtxge5odgJE45KwwXQkaSZEjM13EDpump,0.15,SOL,So11111111111111111111111111111111111111112,0.335145,0.0015,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-FWILL,5QiczEwrbzHNooa54TVkt4oe2HFHLd9u2TCJNX46TJjj,A3kLfkrESnvmZUs54BKYS48bPq4DJT11psfFC5ADMSwS,op8TBkDy4D5gr7xX4VCiC6VvEXCuYV4zo3fhHCEJMFu4Athih23wEzHw24tA1WmjQd4eZ4swA8o7Dii6fk1vC6j,181,6,0,true -2024-12-02 05:59:04.000 UTC,2024-12-02,2024-12-01,Solgun,solana,0.012848601869999999,Sell,0.000056277,SOL,So11111111111111111111111111111111111111112,58135.635755705,LIR,Agdtmev8iBbBJZjXDf6u18M51Bu173gsJTzcWB1patsJ,0.00012876684,5.64e-7,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-LIR,84PapxynnSyNL7LRg4vKg41SVrmU2NqRxaudeQe1NYUb,9gxBDddAvsVUmcLAwJWhnKr5dMN8rWkdqn8ZZ4V272bo,3UBAiPDUWx2jpU4H7u3VV4LkkYXMjxUtbnK2uj71mkHb2T22iWFxvtAnjac4rwQA5itbZb9VahYM4XRbvpEEyxdr,552,4,0,true -2024-12-02 20:48:46.000 UTC,2024-12-02,2024-12-01,Solgun,solana,174.81549384187,Buy,14986480.13779,FAITH,CK3TMoqHy5ApzRwooxbxMAbpGDK2w6KpQMdv2rDhpump,0.782137237,SOL,So11111111111111111111111111111111111111112,1.6763249999999998,0.0075,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-FAITH,5PBojHVrS9C6F6kjTosfVEUoBzED8PCxpFdeouWzDQbd,2kNoYHNtpaefWZ3JptWug7H7pyzXZXYYTQufNbnt3Zzy,3gPFS1BtQArtTN2hZwbrUxKETHiHRts4YCcCEZqFxoGo9E8zpYztsjdtNsUmbK14qNT7VdieNJXbY9tBTembavCB,413,7,4,true -2024-12-02 18:06:48.000 UTC,2024-12-02,2024-12-01,Solgun,solana,30.016174407599998,Buy,1809787.710499,ART,CuSXYspmP7khJiov8Kr3XaExcuhPadVDHGm3K3rvpump,0.13517146,SOL,So11111111111111111111111111111111111111112,0.29361128496,0.001322216,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-ART,GD5CvxQZwKLfqMpvMTeLkTecnMVZGNPXnUk597W1j8hb,H9kHjTaJqVrrSuZGwJWgQnjyhVmGANpqsA6eoqbbZrTk,2SZ1av6twfq14Um3gM8KuRopdqdJpDtESqidS725tKMiDMa1zQu2wnr76JMsbXZMrH5LiUyGv9XPUqMkmwbjW4S9,2628,5,4,true -2024-12-01 23:25:30.000 UTC,2024-12-01,2024-12-01,Solgun,solana,12.139543894200001,Buy,1715893.906365,Bio AI,7LL7cbEfKLMiH4oUmfnfYgAhUnnVRWGeksE6iXjDpump,0.050942274,SOL,So11111111111111111111111111111111111111112,0.2383,0.001,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Bio AI,76BfryV9K9e9o8zF69csrqFLaar2PpdYZ8hN7ZRE4Y3e,H5PQNrAj7uKYK44ksRqym8sAfuasNC4xHJZW88WbzDyT,3YXaTrff9qmYHko2ZD5veVtAcF7XfJa8eCmFBmMtV5dLdowbCn2D2ArfkymQ2ZLon5ExhEYr5qbM54JJbE4NiZtU,475,7,4,true -2024-12-03 20:40:46.000 UTC,2024-12-03,2024-12-01,Solgun,solana,148.38664547177999,Buy,17917109.708311,WILDMNKY,75fv3J8gw9mp64ZVcAXjmr1qT8PqJjE1Cc4ocjmCpump,0.645552273,SOL,So11111111111111111111111111111111111111112,1.3791600000000002,0.006,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,WILDMNKY-SOL,7SV8yk5hXtcXNqgohc9tJMdmAbBnLpbKr8oURHdh8s8g,4Nw2v6XZJgaWHmtETqMWtQyTHaGDtQZ27x3otcvjQAHT,ep8K6Nvu25kw1yVWqENPHv2Y4mGRW5T7kMBxeXnmujd6WoDxzSfVtqASa2fz5toNTyX1JDWecAoMHxTdEsXnkxU,601,7,4,true -2024-12-03 00:15:12.000 UTC,2024-12-03,2024-12-01,Solgun,solana,5.12252529562,Sell,0.022631993,SOL,So11111111111111111111111111111111111111112,27129.461569,anthrupad,2okJ4wqqDFFD2Tce3QaU8L866KxBJzJXVoMtLR1ppump,0.052636498700000006,0.000232555,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-anthrupad,FAfDgkWFexH1BA2D1i5pc2uRR8ZYcvt8jY84CK7e9My8,31M2cNExVg8bwB2HwzAzA1w9pHwLeP67ejygZ44UB1UR,2HryhZK2dRLqZeTowRQ4Rd7BGwL9ekAgyjDuaFvYAJyyVZHn5C81cTGGc66eMRg9MhiiWEdU7j1yWKfJDjdfbMRU,499,4,0,true -2024-12-07 18:47:05.000 UTC,2024-12-07,2024-12-01,Solgun,solana,47.17441114759,Sell,0.195040357,SOL,So11111111111111111111111111111111111111112,12392.36946,AFITR,83Ur4XYc5QyRNBshoW2Yu9cCLyNDV9s5krBu11JWDxxq,0.47612907671000004,0.001968533,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-AFITR,5JtbDjPqfN6K4mDF2c5rvJZXXryQbihjViSP2XoMohSV,8uAied3jRqG1mPRzqsmLaeRDz3F22BkarmfgAvoqNWN,3Lr37rTZUVk9m1iYz3h8sg6Dt4dMHm4PhLmuPUe7G1Z3tMxraN54M8boZMP5wdXGqs8NGQPHMDaXLZoKAq1zMZLE,238,4,0,true -2024-12-01 18:04:29.000 UTC,2024-12-01,2024-12-01,Solgun,solana,32.99628642063,Buy,438388.5076,Metanoia,2dPFQnktvPKZe3hjkstWfJx8tDrH8FW9xoiBjZMEpump,0.139218963,SOL,So11111111111111111111111111111111111111112,0.2986326,0.00126,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Metanoia,FpTruBXx6UcyBiVr2Rj7UMf9tNTpJgTyGpXynpuo9HzA,GhqrMrC4tY8zTDvWHiHG7ag4MWPqQ7qLZmeochY6aosY,29TPJAT4vP7rUmMETneBknCmH8UpzdeFaB6ZpJTmzVobE6kTou8KBgqvPPLb588ettce6HRVFUPcSbuSrRJpJnzG,620,5,4,true -2024-12-01 02:27:09.000 UTC,2024-12-01,2024-12-01,Solgun,solana,19.69581542709,Sell,0.083524089,SOL,So11111111111111111111111111111111111111112,313146.63071,GSC,F86FtKmg8vnaCfDoJF7U21NbmLprVazE3L2PshmCpump,0.26366694273,0.001118133,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GSC,7H6MS1nqg9Y6NN8srD9UCovDQwVxuZaozgXrMT7kcH61,35cx6mhp2Nsi33d7QfwnqVrYoEcyWpc17PtgMrCnwfxt,5K5isZKhK8mwM4rZ7akSejvwByViNxZ5GcCMcsqWENmT42WkJ4kUoYsAJQkeq73pwiEBgjwEoUEgRNB8jCt9Bugp,541,4,0,true -2024-12-04 17:48:52.000 UTC,2024-12-04,2024-12-01,Solgun,solana,29.19816884426,Sell,0.128270302,SOL,So11111111111111111111111111111111111111112,1239313.36229,Pretty,8pTpjjcq5pG7NXDm99NinoT1vRoH99X7s3C1Go3upump,0.30598138415,0.001344205,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Pretty,HBiCDY9CVNWENM8vTkHekJoNAeaLZAJoHr7EwvmAf5WY,GhqrMrC4tY8zTDvWHiHG7ag4MWPqQ7qLZmeochY6aosY,53KrU2unKY95pnSKSq3empC6woBXPxQShDv3EmpDNnn1knesLfxHtCetCkbuNPRWPXr3tj3WKuu8B63Ypawx8yvb,977,3,2,true -2024-12-04 04:50:48.000 UTC,2024-12-04,2024-12-01,Solgun,solana,77.97821513972,Buy,1428724.561159,eigenrobot,9qpaeuNMNWwHfa7keQ51D5VJNt2jessw8khxWis5pump,0.327832402,SOL,So11111111111111111111111111111111111111112,0.7135800000000001,0.003,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-eigenrobot,7Ys5V2wmjz3LihubgfnCdSZnwEUvBNBXXLvpAWZLRiS5,5q853P8PLeYiE5PjXg24kQ9nXrf5Qn6r55A9urS4hYF6,2XPV2bKhVjYGjuLGWhxjUK69mPFqyfFYcBM6HTSnErYLxHP1cNSksWp4i3VbF7QesYJtQnPvtt5aixEbkr137nz1,959,7,4,true -2024-12-04 13:04:31.000 UTC,2024-12-04,2024-12-01,Solgun,solana,0.00010256337,Sell,4.41e-7,SOL,So11111111111111111111111111111111111111112,117382.719111186,FCI,7s9q7HcfMhhf4XoFtHUzJWyAPAN3mSEmBDfB17iM67QJ,9.3028e-7,4e-9,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-FCI,8AfbS9Ji49Jj4UkZmm4whYACyUN8QQQa1dsj9JuYQjFs,EcpfuULFUmouh7XU4uESrksywAwoND2PBu7T3LJwXJmM,4N2Fw8hjiaKSBHnkc7nbH4C6TbjFtpE5RHas2uQKkJvNVUSbwUuTST6GhTueLsrMJe4ho9Sr13xm3V1QQtNzGcSf,460,4,0,true -2024-12-04 20:35:20.000 UTC,2024-12-04,2024-12-01,Solgun,solana,46.792,Buy,66517.719092,convo,KnrmAHo1wW2fGqVXcSZSpo6kmiKam5vNbDByrURpump,0.2,SOL,So11111111111111111111111111111111111111112,0.46792,0.002,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-convo,Exy58ud7t8LHN1EBnrcRRwRQmz1uSUC3hQF9oHpM1Box,5CEbKj8WbqKkah7nhYxkXGvN97xvz5hxd8fQjYnW5NTV,rNFm4bvTJvPVtqQGoBhyFBPhFbJftPVxoasZccwEhaaJqBA4GMVurr3aJTexbDm4p673RSnpTHpnmxLshHmGEK6,38,5,0,true -2024-12-06 07:59:32.000 UTC,2024-12-06,2024-12-01,Solgun,solana,47.796,Buy,8548.498569,PIZZAGUY,5cN4dWZKqxrpwCCBcwHpsAgus1s7WWyRaguR8YbRiECY,0.2,SOL,So11111111111111111111111111111111111111112,0.47796,0.002,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-PIZZAGUY,FgYufZ6c7NpcMvRnbB6tYupsEoyiPCtBw9dZ3bVo8kHE,1EjTzPniAGBxzvi4TBfocfq4Zxuj2GCK42aWnNJEoSS,619fmC5opZwwwAnnci5snSqtVcp9cqPYW2SAiwq8DZQrPVS8F1cLDZW9fzwxdjBYbBKZtBTeMyA9rjeCkLU1U7uE,1700,6,0,true +2024-12-03 03:41:57.000 UTC,2024-12-03,2024-12-01,Tradewiz,solana,5.10029703516,Buy,130284.164414,VIBE,AB4oELjeXLyeV3t3evMgq3zXrxXAJ1WdRy9qgfinH1oq,0.022402148,SOL,So11111111111111111111111111111111111111112,0.04940438999999999,0.000217,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,VIBE-SOL,AKtxTJHHtyDTBUerXQhWQSY4L8oBreBqPHkiPbkyoL3s,8dRLn2NMHsN7Fu1nxCbfQDujQ4wyPaqmnfqHyfVvBnmj,5xYqUmnvW78WSa1VL9G3H2fkRcBbaGRfr95iDTH9JWNTAheT7pnNguneMDzkge9Bqs5KTK8boRHKHPupBtW4hBL1,1139,7,4,true +2024-12-07 15:17:10.000 UTC,2024-12-07,2024-12-01,Tradewiz,solana,2.1149015703,Sell,0.008739985,SOL,So11111111111111111111111111111111111111112,312509.10149,CELLAI3,5q4maTRYm1ZPuFZqFzwYRJ7jAA5xkprmndJdGHUnpjwT,0.0209373195,0.000086525,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-CELLAI3,ARUgR3UzG2KCXWAXQNSHdPuuZ5Spmmm8vTENUn3UK4HU,F6coj9TDxLDw1wSFYsQMPmA2iPYhNxu17qBSEZ8vZuDm,5769zBmZrWqPGqWU9QA2LH5CrjPnJTWePmtC8bgTtciupjiLNuNaYuLS3FEkN7eThaQj57NcTc1Hz39VnkdtDgbB,2030,3,2,true +2024-12-06 19:47:39.000 UTC,2024-12-06,2024-12-01,Tradewiz,solana,5.72664660432,Buy,103332.858778,PAWBLEMS,4fLAZZCA3Mrbj6Wa9PkTUHfUWu3JE2RqGHvDrXiMpump,0.023872964,SOL,So11111111111111111111111111111111111111112,0.047976000000000005,0.0002,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-PAWBLEMS,kLCF7gruvuMfBLvwSL4XZQK2ENKYKm97LFuLAKkxC5b,DksfCf1U4arH6eq9KJJJtHDiYypi3gzwnxbup2266uae,szuK2Sdz9ps9Go88t1FVjFRezggBdh1RqWETVD8voF78mJm97H3pnt6EYrN9aUmYHUmGAvKfrTs46tJfC2F1GCt,1583,5,4,true +2024-12-06 11:48:01.000 UTC,2024-12-06,2024-12-01,Tradewiz,solana,65.36809866600001,Sell,0.279350849,SOL,So11111111111111111111111111111111111111112,371324.880761,HYPHAL,2gsxJ1fyLi3kzvjQx8Wd8y323Ptigzj9ti54grHkpump,0.658593702,0.002814503,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-HYPHAL,2YeDSYdr9mMvEtiWskGvHbt6WSZ6wHW9xGi8DuB9GjdJ,Ed1rA4YjgtJMExjQ6sjWrEEj7xaeL6f4yvT39sm8fZo8,3VN42UsvXsxqnUDiTDQaHhrWmGCwoWnfJJWyPbz7nvja5n9EZohisb7ZR4ojD3LzDG8rquC74kJY3Z3bHac6FYqh,64,4,0,true +2024-12-03 06:01:15.000 UTC,2024-12-03,2024-12-01,Tradewiz,solana,12.54215028618,Sell,0.055040814,SOL,So11111111111111111111111111111111111111112,434296.831722,Pooch,csrNabqJ6eKoueCiVxGWTTbN3Bri1MhwbwoCN2Wpump,0.12432632773999999,0.000545602,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Pooch,H82eA83r3Djyt1s4T6213puNzM1As8w2tCSYjgv6kjFz,66gfZJ3yVCxhRY3VvSKxTYhrW4HAUvhbVFRCRrgoATkE,3hhXSyxnoA3U1eYsY2P8EjAqen3mWBscPoPK4pudmobfENN1VKCzAHKPaBQRk4S98W9fB41tm4MgUJ1NE4F4ZjNt,413,3,2,true +2024-12-02 18:50:09.000 UTC,2024-12-02,2024-12-01,Tradewiz,solana,33.5145,Buy,1090000.477547,FWILL,8aMmdyEH97qmtxge5odgJE45KwwXQkaSZEjM13EDpump,0.15,SOL,So11111111111111111111111111111111111111112,0.335145,0.0015,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-FWILL,5QiczEwrbzHNooa54TVkt4oe2HFHLd9u2TCJNX46TJjj,A3kLfkrESnvmZUs54BKYS48bPq4DJT11psfFC5ADMSwS,op8TBkDy4D5gr7xX4VCiC6VvEXCuYV4zo3fhHCEJMFu4Athih23wEzHw24tA1WmjQd4eZ4swA8o7Dii6fk1vC6j,181,6,0,true +2024-12-02 05:59:04.000 UTC,2024-12-02,2024-12-01,Tradewiz,solana,0.012848601869999999,Sell,0.000056277,SOL,So11111111111111111111111111111111111111112,58135.635755705,LIR,Agdtmev8iBbBJZjXDf6u18M51Bu173gsJTzcWB1patsJ,0.00012876684,5.64e-7,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-LIR,84PapxynnSyNL7LRg4vKg41SVrmU2NqRxaudeQe1NYUb,9gxBDddAvsVUmcLAwJWhnKr5dMN8rWkdqn8ZZ4V272bo,3UBAiPDUWx2jpU4H7u3VV4LkkYXMjxUtbnK2uj71mkHb2T22iWFxvtAnjac4rwQA5itbZb9VahYM4XRbvpEEyxdr,552,4,0,true +2024-12-02 20:48:46.000 UTC,2024-12-02,2024-12-01,Tradewiz,solana,174.81549384187,Buy,14986480.13779,FAITH,CK3TMoqHy5ApzRwooxbxMAbpGDK2w6KpQMdv2rDhpump,0.782137237,SOL,So11111111111111111111111111111111111111112,1.6763249999999998,0.0075,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-FAITH,5PBojHVrS9C6F6kjTosfVEUoBzED8PCxpFdeouWzDQbd,2kNoYHNtpaefWZ3JptWug7H7pyzXZXYYTQufNbnt3Zzy,3gPFS1BtQArtTN2hZwbrUxKETHiHRts4YCcCEZqFxoGo9E8zpYztsjdtNsUmbK14qNT7VdieNJXbY9tBTembavCB,413,7,4,true +2024-12-02 18:06:48.000 UTC,2024-12-02,2024-12-01,Tradewiz,solana,30.016174407599998,Buy,1809787.710499,ART,CuSXYspmP7khJiov8Kr3XaExcuhPadVDHGm3K3rvpump,0.13517146,SOL,So11111111111111111111111111111111111111112,0.29361128496,0.001322216,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-ART,GD5CvxQZwKLfqMpvMTeLkTecnMVZGNPXnUk597W1j8hb,H9kHjTaJqVrrSuZGwJWgQnjyhVmGANpqsA6eoqbbZrTk,2SZ1av6twfq14Um3gM8KuRopdqdJpDtESqidS725tKMiDMa1zQu2wnr76JMsbXZMrH5LiUyGv9XPUqMkmwbjW4S9,2628,5,4,true +2024-12-01 23:25:30.000 UTC,2024-12-01,2024-12-01,Tradewiz,solana,12.139543894200001,Buy,1715893.906365,Bio AI,7LL7cbEfKLMiH4oUmfnfYgAhUnnVRWGeksE6iXjDpump,0.050942274,SOL,So11111111111111111111111111111111111111112,0.2383,0.001,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Bio AI,76BfryV9K9e9o8zF69csrqFLaar2PpdYZ8hN7ZRE4Y3e,H5PQNrAj7uKYK44ksRqym8sAfuasNC4xHJZW88WbzDyT,3YXaTrff9qmYHko2ZD5veVtAcF7XfJa8eCmFBmMtV5dLdowbCn2D2ArfkymQ2ZLon5ExhEYr5qbM54JJbE4NiZtU,475,7,4,true +2024-12-03 20:40:46.000 UTC,2024-12-03,2024-12-01,Tradewiz,solana,148.38664547177999,Buy,17917109.708311,WILDMNKY,75fv3J8gw9mp64ZVcAXjmr1qT8PqJjE1Cc4ocjmCpump,0.645552273,SOL,So11111111111111111111111111111111111111112,1.3791600000000002,0.006,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,WILDMNKY-SOL,7SV8yk5hXtcXNqgohc9tJMdmAbBnLpbKr8oURHdh8s8g,4Nw2v6XZJgaWHmtETqMWtQyTHaGDtQZ27x3otcvjQAHT,ep8K6Nvu25kw1yVWqENPHv2Y4mGRW5T7kMBxeXnmujd6WoDxzSfVtqASa2fz5toNTyX1JDWecAoMHxTdEsXnkxU,601,7,4,true +2024-12-03 00:15:12.000 UTC,2024-12-03,2024-12-01,Tradewiz,solana,5.12252529562,Sell,0.022631993,SOL,So11111111111111111111111111111111111111112,27129.461569,anthrupad,2okJ4wqqDFFD2Tce3QaU8L866KxBJzJXVoMtLR1ppump,0.052636498700000006,0.000232555,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-anthrupad,FAfDgkWFexH1BA2D1i5pc2uRR8ZYcvt8jY84CK7e9My8,31M2cNExVg8bwB2HwzAzA1w9pHwLeP67ejygZ44UB1UR,2HryhZK2dRLqZeTowRQ4Rd7BGwL9ekAgyjDuaFvYAJyyVZHn5C81cTGGc66eMRg9MhiiWEdU7j1yWKfJDjdfbMRU,499,4,0,true +2024-12-07 18:47:05.000 UTC,2024-12-07,2024-12-01,Tradewiz,solana,47.17441114759,Sell,0.195040357,SOL,So11111111111111111111111111111111111111112,12392.36946,AFITR,83Ur4XYc5QyRNBshoW2Yu9cCLyNDV9s5krBu11JWDxxq,0.47612907671000004,0.001968533,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-AFITR,5JtbDjPqfN6K4mDF2c5rvJZXXryQbihjViSP2XoMohSV,8uAied3jRqG1mPRzqsmLaeRDz3F22BkarmfgAvoqNWN,3Lr37rTZUVk9m1iYz3h8sg6Dt4dMHm4PhLmuPUe7G1Z3tMxraN54M8boZMP5wdXGqs8NGQPHMDaXLZoKAq1zMZLE,238,4,0,true +2024-12-01 18:04:29.000 UTC,2024-12-01,2024-12-01,Tradewiz,solana,32.99628642063,Buy,438388.5076,Metanoia,2dPFQnktvPKZe3hjkstWfJx8tDrH8FW9xoiBjZMEpump,0.139218963,SOL,So11111111111111111111111111111111111111112,0.2986326,0.00126,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Metanoia,FpTruBXx6UcyBiVr2Rj7UMf9tNTpJgTyGpXynpuo9HzA,GhqrMrC4tY8zTDvWHiHG7ag4MWPqQ7qLZmeochY6aosY,29TPJAT4vP7rUmMETneBknCmH8UpzdeFaB6ZpJTmzVobE6kTou8KBgqvPPLb588ettce6HRVFUPcSbuSrRJpJnzG,620,5,4,true +2024-12-01 02:27:09.000 UTC,2024-12-01,2024-12-01,Tradewiz,solana,19.69581542709,Sell,0.083524089,SOL,So11111111111111111111111111111111111111112,313146.63071,GSC,F86FtKmg8vnaCfDoJF7U21NbmLprVazE3L2PshmCpump,0.26366694273,0.001118133,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GSC,7H6MS1nqg9Y6NN8srD9UCovDQwVxuZaozgXrMT7kcH61,35cx6mhp2Nsi33d7QfwnqVrYoEcyWpc17PtgMrCnwfxt,5K5isZKhK8mwM4rZ7akSejvwByViNxZ5GcCMcsqWENmT42WkJ4kUoYsAJQkeq73pwiEBgjwEoUEgRNB8jCt9Bugp,541,4,0,true +2024-12-04 17:48:52.000 UTC,2024-12-04,2024-12-01,Tradewiz,solana,29.19816884426,Sell,0.128270302,SOL,So11111111111111111111111111111111111111112,1239313.36229,Pretty,8pTpjjcq5pG7NXDm99NinoT1vRoH99X7s3C1Go3upump,0.30598138415,0.001344205,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Pretty,HBiCDY9CVNWENM8vTkHekJoNAeaLZAJoHr7EwvmAf5WY,GhqrMrC4tY8zTDvWHiHG7ag4MWPqQ7qLZmeochY6aosY,53KrU2unKY95pnSKSq3empC6woBXPxQShDv3EmpDNnn1knesLfxHtCetCkbuNPRWPXr3tj3WKuu8B63Ypawx8yvb,977,3,2,true +2024-12-04 04:50:48.000 UTC,2024-12-04,2024-12-01,Tradewiz,solana,77.97821513972,Buy,1428724.561159,eigenrobot,9qpaeuNMNWwHfa7keQ51D5VJNt2jessw8khxWis5pump,0.327832402,SOL,So11111111111111111111111111111111111111112,0.7135800000000001,0.003,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-eigenrobot,7Ys5V2wmjz3LihubgfnCdSZnwEUvBNBXXLvpAWZLRiS5,5q853P8PLeYiE5PjXg24kQ9nXrf5Qn6r55A9urS4hYF6,2XPV2bKhVjYGjuLGWhxjUK69mPFqyfFYcBM6HTSnErYLxHP1cNSksWp4i3VbF7QesYJtQnPvtt5aixEbkr137nz1,959,7,4,true +2024-12-04 13:04:31.000 UTC,2024-12-04,2024-12-01,Tradewiz,solana,0.00010256337,Sell,4.41e-7,SOL,So11111111111111111111111111111111111111112,117382.719111186,FCI,7s9q7HcfMhhf4XoFtHUzJWyAPAN3mSEmBDfB17iM67QJ,9.3028e-7,4e-9,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-FCI,8AfbS9Ji49Jj4UkZmm4whYACyUN8QQQa1dsj9JuYQjFs,EcpfuULFUmouh7XU4uESrksywAwoND2PBu7T3LJwXJmM,4N2Fw8hjiaKSBHnkc7nbH4C6TbjFtpE5RHas2uQKkJvNVUSbwUuTST6GhTueLsrMJe4ho9Sr13xm3V1QQtNzGcSf,460,4,0,true +2024-12-04 20:35:20.000 UTC,2024-12-04,2024-12-01,Tradewiz,solana,46.792,Buy,66517.719092,convo,KnrmAHo1wW2fGqVXcSZSpo6kmiKam5vNbDByrURpump,0.2,SOL,So11111111111111111111111111111111111111112,0.46792,0.002,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-convo,Exy58ud7t8LHN1EBnrcRRwRQmz1uSUC3hQF9oHpM1Box,5CEbKj8WbqKkah7nhYxkXGvN97xvz5hxd8fQjYnW5NTV,rNFm4bvTJvPVtqQGoBhyFBPhFbJftPVxoasZccwEhaaJqBA4GMVurr3aJTexbDm4p673RSnpTHpnmxLshHmGEK6,38,5,0,true +2024-12-06 07:59:32.000 UTC,2024-12-06,2024-12-01,Tradewiz,solana,47.796,Buy,8548.498569,PIZZAGUY,5cN4dWZKqxrpwCCBcwHpsAgus1s7WWyRaguR8YbRiECY,0.2,SOL,So11111111111111111111111111111111111111112,0.47796,0.002,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-PIZZAGUY,FgYufZ6c7NpcMvRnbB6tYupsEoyiPCtBw9dZ3bVo8kHE,1EjTzPniAGBxzvi4TBfocfq4Zxuj2GCK42aWnNJEoSS,619fmC5opZwwwAnnci5snSqtVcp9cqPYW2SAiwq8DZQrPVS8F1cLDZW9fzwxdjBYbBKZtBTeMyA9rjeCkLU1U7uE,1700,6,0,true From fbbdd8ce00693d16db675610dafd7d10d7c77001 Mon Sep 17 00:00:00 2001 From: intensodefi Date: Fri, 13 Dec 2024 03:01:50 +0700 Subject: [PATCH 04/32] Add Levinswap to dex.trades (#7315) * Update dex_info.sql * Update _schema.yml * Update dex_gnosis_base_trades.sql * Create levinswap_gnosis_base_trades.sql * Update _schema.yml * Create levinswap_gnosis_base_trades_seed.csv * Update _sources.yml --------- Co-authored-by: Huang Geyang --- dbt_subprojects/dex/models/dex_info.sql | 1 + .../dex/models/trades/gnosis/_schema.yml | 16 ++++++++++++++ .../trades/gnosis/dex_gnosis_base_trades.sql | 1 + .../levinswap_gnosis_base_trades.sql | 21 +++++++++++++++++++ dbt_subprojects/dex/seeds/trades/_schema.yml | 15 +++++++++++++ .../levinswap_gnosis_base_trades_seed.csv | 2 ++ .../_sector/dex/trades/gnosis/_sources.yml | 4 ++++ 7 files changed, 60 insertions(+) create mode 100644 dbt_subprojects/dex/models/trades/gnosis/platforms/levinswap_gnosis_base_trades.sql create mode 100644 dbt_subprojects/dex/seeds/trades/levinswap_gnosis_base_trades_seed.csv diff --git a/dbt_subprojects/dex/models/dex_info.sql b/dbt_subprojects/dex/models/dex_info.sql index f5ffa82a7d7..2de3399cc3c 100644 --- a/dbt_subprojects/dex/models/dex_info.sql +++ b/dbt_subprojects/dex/models/dex_info.sql @@ -191,4 +191,5 @@ FROM (VALUES , ('akronswap', 'Akronswap', 'Direct', 'AkronFinance') , ('katana', 'Katana', 'Direct', 'AxieInfinity') , ('jetswap', 'JetSwap', 'Direct', 'Jetfuelfinance') + , ('levinswap', 'Levinswap', 'Direct', 'levinswap') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/dbt_subprojects/dex/models/trades/gnosis/_schema.yml b/dbt_subprojects/dex/models/trades/gnosis/_schema.yml index 1ac8909ff33..2dee59ac657 100644 --- a/dbt_subprojects/dex/models/trades/gnosis/_schema.yml +++ b/dbt_subprojects/dex/models/trades/gnosis/_schema.yml @@ -117,3 +117,19 @@ models: - check_dex_base_trades_seed: seed_file: ref('elk_finance_gnosis_base_trades_seed') + - name: levinswap_gnosis_base_trades + meta: + blockchain: gnosis + sector: dex + project: levinswap + contributors: intensodefi + config: + tags: ['gnosis', 'dex', 'trades', 'levinswap'] + description: "levinswap gnosis base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('levinswap_gnosis_base_trades_seed') diff --git a/dbt_subprojects/dex/models/trades/gnosis/dex_gnosis_base_trades.sql b/dbt_subprojects/dex/models/trades/gnosis/dex_gnosis_base_trades.sql index 70883d551bb..599b6cdceb4 100644 --- a/dbt_subprojects/dex/models/trades/gnosis/dex_gnosis_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/gnosis/dex_gnosis_base_trades.sql @@ -12,6 +12,7 @@ , ref('balancer_v3_gnosis_base_trades') , ref('honeyswap_v2_gnosis_base_trades') , ref('elk_finance_gnosis_base_trades') + , ref('levinswap_gnosis_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/gnosis/platforms/levinswap_gnosis_base_trades.sql b/dbt_subprojects/dex/models/trades/gnosis/platforms/levinswap_gnosis_base_trades.sql new file mode 100644 index 00000000000..48b6edd32f9 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/gnosis/platforms/levinswap_gnosis_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'levinswap_gnosis', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'gnosis', + project = 'levinswap', + version = '1', + Pair_evt_Swap = source('levinswap_gnosis', 'UniswapV2Pair_evt_Swap'), + Factory_evt_PairCreated = source('levinswap_gnosis', 'UniswapV2Factory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index 5164c88beac..548192dab81 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4559,3 +4559,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: levinswap_gnosis_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp diff --git a/dbt_subprojects/dex/seeds/trades/levinswap_gnosis_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/levinswap_gnosis_base_trades_seed.csv new file mode 100644 index 00000000000..614606ee402 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/levinswap_gnosis_base_trades_seed.csv @@ -0,0 +1,2 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +gnosis,levinswap,1,2024-11-22,0x92f310ece1e89b668d91ef9993a2806e4a0d2e4bb2b2803701c05cb455cff397,8,0xc1014b2ad0a731a28c0b74890ad3c50837faa309,0xddafbb505ad214d7b80b1f830fccc89b60fb7a83,37159382,10000000000000000,508965 diff --git a/sources/_sector/dex/trades/gnosis/_sources.yml b/sources/_sector/dex/trades/gnosis/_sources.yml index 821fa073bb9..c040eebe4a1 100644 --- a/sources/_sector/dex/trades/gnosis/_sources.yml +++ b/sources/_sector/dex/trades/gnosis/_sources.yml @@ -20,3 +20,7 @@ sources: tables: - name: ElkPair_evt_Swap - name: ElkFactory_evt_PairCreated + - name: levinswap_gnosis + tables: + - name: UniswapV2Pair_evt_Swap + - name: UniswapV2Factory_evt_PairCreated From ddb63e185f018c4850c4d1892fae8538ef5e254f Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:02:02 +0000 Subject: [PATCH 05/32] add erc4626 token pricing to balancer.trades (#7301) * add erc4626 token pricing to balancer.trades * fix copypasta * add missing comma * remove extra comma * remove extra comma * fix erc4626_token_prices * fix group by * fix wrong reference --- .../ethereum/balancer_v3_ethereum_trades.sql | 26 ++++++++++++++++--- .../gnosis/balancer_v3_gnosis_trades.sql | 26 ++++++++++++++++--- .../spellbook/_sources.yml | 3 +++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/dbt_subprojects/dex/models/_projects/balancer/trades/ethereum/balancer_v3_ethereum_trades.sql b/dbt_subprojects/dex/models/_projects/balancer/trades/ethereum/balancer_v3_ethereum_trades.sql index 71d7257a356..ad927febd4c 100644 --- a/dbt_subprojects/dex/models/_projects/balancer/trades/ethereum/balancer_v3_ethereum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/balancer/trades/ethereum/balancer_v3_ethereum_trades.sql @@ -91,6 +91,18 @@ WITH AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) AND bpt_prices.blockchain = 'ethereum' GROUP BY 1, 2, 3, 4, 5 + ), + + erc4626_prices AS( + SELECT + minute, + wrapped_token, + decimals, + APPROX_PERCENTILE(median_price, 0.5) AS price, + LEAD(minute, 1, NOW()) OVER (PARTITION BY wrapped_token ORDER BY minute) AS time_of_next_change + FROM {{ source('balancer_v3', 'erc4626_token_prices') }} + WHERE blockchain = 'ethereum' + GROUP BY 1, 2, 3 ) SELECT @@ -110,8 +122,8 @@ SELECT dexs.token_sold_amount_raw, COALESCE( dexs.amount_usd, - dexs.token_bought_amount_raw / POWER(10, COALESCE(erc20a.decimals, 18)) * bpa_bpt_prices.bpt_price, - dexs.token_sold_amount_raw / POWER(10, COALESCE(erc20b.decimals, 18)) * bpb_bpt_prices.bpt_price + dexs.token_bought_amount_raw / POWER(10, COALESCE(erc20a.decimals, erc4626a.decimals, 18)) * COALESCE(bpa_bpt_prices.bpt_price, erc4626a.price), + dexs.token_sold_amount_raw / POWER(10, COALESCE(erc20b.decimals, erc4626b.decimals, 18)) * COALESCE(bpb_bpt_prices.bpt_price, erc4626b.price) ) AS amount_usd, dexs.token_bought_address, dexs.token_sold_address, @@ -148,4 +160,12 @@ FROM dexs LEFT JOIN {{ source('balancer', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date - AND bpb_bpt_prices.blockchain = 'ethereum' \ No newline at end of file + AND bpb_bpt_prices.blockchain = 'ethereum' + LEFT JOIN erc4626_prices erc4626a + ON erc4626a.wrapped_token = dexs.token_bought_address + AND erc4626a.minute <= dexs.block_time + AND dexs.block_time < erc4626a.time_of_next_change + LEFT JOIN erc4626_prices erc4626b + ON erc4626b.wrapped_token = dexs.token_sold_address + AND erc4626b.minute <= dexs.block_time + AND dexs.block_time < erc4626b.time_of_next_change \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/balancer/trades/gnosis/balancer_v3_gnosis_trades.sql b/dbt_subprojects/dex/models/_projects/balancer/trades/gnosis/balancer_v3_gnosis_trades.sql index 71b73f5fa60..7aea4bcc382 100644 --- a/dbt_subprojects/dex/models/_projects/balancer/trades/gnosis/balancer_v3_gnosis_trades.sql +++ b/dbt_subprojects/dex/models/_projects/balancer/trades/gnosis/balancer_v3_gnosis_trades.sql @@ -91,6 +91,18 @@ WITH AND bpt_prices.day <= DATE_TRUNC('day', dexs.block_time) AND bpt_prices.blockchain = 'gnosis' GROUP BY 1, 2, 3, 4, 5 + ), + + erc4626_prices AS( + SELECT + minute, + wrapped_token, + decimals, + APPROX_PERCENTILE(median_price, 0.5) AS price, + LEAD(minute, 1, NOW()) OVER (PARTITION BY wrapped_token ORDER BY minute) AS time_of_next_change + FROM {{ source('balancer_v3', 'erc4626_token_prices') }} + WHERE blockchain = 'gnosis' + GROUP BY 1, 2, 3 ) SELECT @@ -110,8 +122,8 @@ SELECT dexs.token_sold_amount_raw, COALESCE( dexs.amount_usd, - dexs.token_bought_amount_raw / POWER(10, COALESCE(erc20a.decimals, 18)) * bpa_bpt_prices.bpt_price, - dexs.token_sold_amount_raw / POWER(10, COALESCE(erc20b.decimals, 18)) * bpb_bpt_prices.bpt_price + dexs.token_bought_amount_raw / POWER(10, COALESCE(erc20a.decimals, erc4626a.decimals, 18)) * COALESCE(bpa_bpt_prices.bpt_price, erc4626a.price), + dexs.token_sold_amount_raw / POWER(10, COALESCE(erc20b.decimals, erc4626b.decimals, 18)) * COALESCE(bpb_bpt_prices.bpt_price, erc4626b.price) ) AS amount_usd, dexs.token_bought_address, dexs.token_sold_address, @@ -148,4 +160,12 @@ FROM dexs LEFT JOIN {{ source('balancer', 'bpt_prices') }} bpb_bpt_prices ON bpb_bpt_prices.contract_address = bpb.contract_address AND bpb_bpt_prices.day = bpb.bpb_max_block_date - AND bpb_bpt_prices.blockchain = 'gnosis' \ No newline at end of file + AND bpb_bpt_prices.blockchain = 'gnosis' + LEFT JOIN erc4626_prices erc4626a + ON erc4626a.wrapped_token = dexs.token_bought_address + AND erc4626a.minute <= dexs.block_time + AND dexs.block_time < erc4626a.time_of_next_change + LEFT JOIN erc4626_prices erc4626b + ON erc4626b.wrapped_token = dexs.token_sold_address + AND erc4626b.minute <= dexs.block_time + AND dexs.block_time < erc4626b.time_of_next_change \ No newline at end of file diff --git a/sources/_subprojects_outputs/spellbook/_sources.yml b/sources/_subprojects_outputs/spellbook/_sources.yml index 65c11b935de..9aa040b2036 100644 --- a/sources/_subprojects_outputs/spellbook/_sources.yml +++ b/sources/_subprojects_outputs/spellbook/_sources.yml @@ -116,6 +116,9 @@ sources: - name: balancer_v3_gnosis tables: - name: bpt_prices + - name: balancer_v3 + tables: + - name: erc4626_token_prices - name: addresses_ethereum tables: From 427f6748d2f84829a683df033d6acd1677f6f06a Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Thu, 12 Dec 2024 21:02:11 +0100 Subject: [PATCH 06/32] Cowprotocol/add base (#7295) * [cowprotocol] Add Base tables * add union in batches * remove comment * fix solver table reference * ad base sources * add another missing base reference * retrigger CI * fix solver query * remove batches changes --- .../models/_projects/cow_protocol/_schema.yml | 107 +++++++- .../base/cow_protocol_base_trades.sql | 257 ++++++++++++++++++ .../cow_protocol/cow_protocol_trades.sql | 30 ++ sources/_subprojects_outputs/dex/_sources.yml | 11 +- .../base/cow_protocol_base_sources.yml | 160 +++++++++++ 5 files changed, 550 insertions(+), 15 deletions(-) create mode 100644 dbt_subprojects/dex/models/_projects/cow_protocol/base/cow_protocol_base_trades.sql create mode 100644 sources/cow_protocol/base/cow_protocol_base_sources.yml diff --git a/dbt_subprojects/dex/models/_projects/cow_protocol/_schema.yml b/dbt_subprojects/dex/models/_projects/cow_protocol/_schema.yml index 958a9d028d5..9e0e203f3ef 100644 --- a/dbt_subprojects/dex/models/_projects/cow_protocol/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/cow_protocol/_schema.yml @@ -8,18 +8,26 @@ models: project: cow_protocol contributors: bh2smith, gentrexha config: - tags: ['ethereum','cow_protocol','trades','dex','aggregator','cross-chain'] + tags: + [ + "ethereum", + "cow_protocol", + "trades", + "dex", + "aggregator", + "cross-chain", + ] description: > - CoW Protocol trades on all chains across all contracts and versions. - This table will load dex trades downstream. - This particular version of the protocol trades table is intended to conform - with the columns as specified in dex.trades sector. - A more detailed version of the protocol trades table can be found under `cow_protocol_ethereum.trades` + CoW Protocol trades on all chains across all contracts and versions. + This table will load dex trades downstream. + This particular version of the protocol trades table is intended to conform + with the columns as specified in dex.trades sector. + A more detailed version of the protocol trades table can be found under `cow_protocol_ethereum.trades` columns: - &blockchain name: blockchain description: "Blockchain which the project is deployed" - - &project + - &project name: project description: "Project name" - &version @@ -92,7 +100,7 @@ models: project: cow_protocol contributors: olgafetisova config: - tags: ['arbitrum','cow_protocol','trades', 'dex', 'aggregator'] + tags: ["arbitrum", "cow_protocol", "trades", "dex", "aggregator"] description: > CoW Protocol enriched trades list on Arbitrum Chain data_tests: @@ -169,7 +177,7 @@ models: project: cow_protocol contributors: bh2smith, gentrexha config: - tags: ['ethereum','cow_protocol','trades', 'dex', 'aggregator'] + tags: ["ethereum", "cow_protocol", "trades", "dex", "aggregator"] description: > CoW Protocol enriched trades list on Ethereum data_tests: @@ -253,7 +261,7 @@ models: project: cow_protocol contributors: bh2smith config: - tags: ['gnosis','cow_protocol','trades', 'dex', 'aggregator'] + tags: ["gnosis", "cow_protocol", "trades", "dex", "aggregator"] description: > CoW Protocol enriched trades list on Gnosis Chain data_tests: @@ -322,4 +330,81 @@ models: - name: flags description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" - name: surplus_usd - description: "USD value of surplus (difference between limit and executed price)" \ No newline at end of file + description: "USD value of surplus (difference between limit and executed price)" + + - name: cow_protocol_base_trades + meta: + blockchain: base + project: cow_protocol + contributors: felix + config: + tags: ["base", "cow_protocol", "trades", "dex", "aggregator"] + description: > + CoW Protocol enriched trades list on Base + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - order_uid + - evt_index + columns: + - name: block_date + description: "UTC event block date of each trade" + - name: block_time + description: "Timestamp for block event time in UTC" + - name: tx_hash + description: "Transaction hash of trade" + - name: evt_index + description: "Index of the corresponding trade event" + - name: order_uid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - name: trader + description: "Owner of the order being traded (aka trader)" + - name: sell_token_address + description: "Ethereum address of sellToken" + - name: sell_token + description: "Symbol of sellToken" + - name: buy_token_address + description: "Ethereum address of buyToken" + - name: buy_token + description: "Symbol of buyToken" + - name: token_pair + description: "Ordered concatenation of buy/sell token symbols involved in trade" + - name: units_sold + description: "Units of sellToken sold (incorporates token decimals)." + - name: atoms_sold + description: "Amount (in atoms) of the sellToken sold" + - name: units_bought + description: "Units of buyToken bought (incorporates token decimals)." + - name: atoms_bought + description: "Amount (in atoms) of the buyToken bought" + - name: usd_value + description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)" + - name: buy_price + description: "USD price of buyToken at the time of trade" + - name: buy_value_usd + description: "USD value of buyToken amount" + - name: sell_price + description: "USD price of sellToken at the time of trade" + - name: sell_value_usd + description: "USD value of sellToken amount" + - name: fee + description: "Unit of fee taken (in sellToken) - incorporating token decimals" + - name: fee_atoms + description: "Amount (in atoms) of fee - taken in sellToken" + - name: fee_usd + description: "USD value of trade fee" + - name: app_data + description: "Hashed metadata related to trade event (full content available on IPFS)" + - name: receiver + description: "Recipient of trades buyToken" + - name: limit_sell_amount + description: "Sell amount side of the limit price" + - name: limit_buy_amount + description: "Buy amount side of the limit price" + - name: valid_to + description: "epoch timestamp (in seconds) until when the order was valid" + - name: flags + description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)" + - name: surplus_usd + description: "USD value of surplus (difference between limit and executed price)" diff --git a/dbt_subprojects/dex/models/_projects/cow_protocol/base/cow_protocol_base_trades.sql b/dbt_subprojects/dex/models/_projects/cow_protocol/base/cow_protocol_base_trades.sql new file mode 100644 index 00000000000..449e1b0f3d5 --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/cow_protocol/base/cow_protocol_base_trades.sql @@ -0,0 +1,257 @@ +{{ config( + schema='cow_protocol_base', + alias='trades', + materialized='incremental', + partition_by = ['block_month'], + unique_key = ['tx_hash', 'order_uid', 'evt_index'], + on_schema_change='sync_all_columns', + file_format ='delta', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook='{{ expose_spells(\'["base"]\', + "project", + "cow_protocol", + \'["felix"]\') }}' + ) +}} + +WITH +-- First subquery joins buy and sell token prices from prices.usd. +-- Also deducts fee from sell amount. +trades_with_prices AS ( + SELECT cast(date_trunc('day', evt_block_time) as date) as block_date, + cast(date_trunc('month', evt_block_time) as date) as block_month, + evt_block_time as block_time, + evt_block_number as block_number, + evt_tx_hash as tx_hash, + evt_index, + trade.contract_address as project_contract_address, + owner as trader, + orderUid as order_uid, + sellToken as sell_token, + buyToken as buy_token, + sellAmount - feeAmount as sell_amount, + buyAmount as buy_amount, + feeAmount as fee_amount, + ps.price as sell_price, + pb.price as buy_price + FROM {{ source('gnosis_protocol_v2_base', 'GPv2Settlement_evt_Trade') }} trade + LEFT OUTER JOIN {{ source('prices', 'usd') }} as ps + ON sellToken = ps.contract_address + AND ps.minute = date_trunc('minute', evt_block_time) + AND ps.blockchain = 'base' + {% if is_incremental() %} + AND {{ incremental_predicate('ps.minute') }} + {% endif %} + LEFT OUTER JOIN {{ source('prices', 'usd') }} as pb + ON pb.contract_address = ( + CASE + WHEN buyToken = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + THEN 0x4200000000000000000000000000000000000006 + ELSE buyToken + END) + AND pb.minute = date_trunc('minute', evt_block_time) + AND pb.blockchain = 'base' + {% if is_incremental() %} + AND {{ incremental_predicate('pb.minute') }} + {% endif %} + {% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} + {% endif %} +), +-- Second subquery gets token symbol and decimals from tokens.erc20 (to display units bought and sold) +trades_with_token_units as ( + SELECT block_date, + block_month, + block_time, + block_number, + tx_hash, + evt_index, + project_contract_address, + order_uid, + trader, + sell_token as sell_token_address, + (CASE + WHEN ts.symbol IS NULL THEN cast(sell_token as varchar) + ELSE ts.symbol + END) as sell_token, + buy_token as buy_token_address, + (CASE + WHEN tb.symbol IS NULL THEN cast(buy_token as varchar) + WHEN buy_token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee THEN 'ETH' + ELSE tb.symbol + END) as buy_token, + sell_amount / pow(10, ts.decimals) as units_sold, + sell_amount as atoms_sold, + buy_amount / pow(10, tb.decimals) as units_bought, + buy_amount as atoms_bought, + -- We use sell value when possible and buy value when not + fee_amount / pow(10, ts.decimals) as fee, + fee_amount as fee_atoms, + sell_price, + buy_price + FROM trades_with_prices + LEFT OUTER JOIN {{ source('tokens', 'erc20') }} ts + ON ts.blockchain='base' AND ts.contract_address = sell_token + LEFT OUTER JOIN {{ source('tokens', 'erc20') }} tb + ON tb.blockchain='base' AND tb.contract_address = + (CASE + WHEN buy_token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + THEN 0x4200000000000000000000000000000000000006 + ELSE buy_token + END) +), +sorted_orders as ( + select + evt_tx_hash, + evt_block_number, + array_agg(orderUid order by evt_index) as order_ids + from ( + select + evt_tx_hash, + evt_index, + evt_block_number, + orderUid + from {{ source('gnosis_protocol_v2_base', 'GPv2Settlement_evt_Trade') }} + {% if is_incremental() %} + where {{ incremental_predicate('evt_block_time') }} + {% endif %} + ) + group by evt_tx_hash, evt_block_number +), + +orders_and_trades as ( + select + evt_tx_hash, + trades, + order_ids + from sorted_orders + inner join {{ source('gnosis_protocol_v2_base', 'GPv2Settlement_call_settle') }} + on evt_block_number = call_block_number + and evt_tx_hash = call_tx_hash +), + +uid_to_app_id as ( + SELECT + distinct uid, + evt_tx_hash as hash, + from_hex(JSON_EXTRACT_SCALAR(trade, '$.appData')) AS app_data, + from_hex(JSON_EXTRACT_SCALAR(trade, '$.receiver')) AS receiver, + cast(JSON_EXTRACT_SCALAR(trade, '$.sellAmount') as uint256) AS limit_sell_amount, + cast(JSON_EXTRACT_SCALAR(trade, '$.buyAmount') as uint256) AS limit_buy_amount, + date_format( + from_unixtime(cast(JSON_EXTRACT_SCALAR(trade, '$.validTo') as double)), + '%Y-%m-%d %T' + ) AS valid_to, + cast(JSON_EXTRACT_SCALAR(trade, '$.flags') as integer) AS flags + FROM + orders_and_trades + CROSS JOIN UNNEST (order_ids) + WITH + ORDINALITY AS o (uid, i) + CROSS JOIN UNNEST (trades) + WITH + ORDINALITY AS t (trade, j) + WHERE + i = j +), + +eth_flow_senders as ( + select + sender, + bytearray_concat( + bytearray_concat( + output_orderHash, + bytearray_substring(event.contract_address, 1, 20) + ), + 0xffffffff + ) AS order_uid + from {{ source('cow_protocol_base', 'CoWSwapEthFlow_evt_OrderPlacement') }} event + inner join {{ source('cow_protocol_base', 'CoWSwapEthFlow_call_createOrder') }} call + on call_block_number = evt_block_number + and call_tx_hash = evt_tx_hash + {% if is_incremental() %} + where {{ incremental_predicate('evt_block_time') }} + {% endif %} +), + +valued_trades as ( + SELECT block_date, + block_month, + block_time, + block_number, + tx_hash, + evt_index, + ARRAY[-1] as trace_address, + project_contract_address, + trades.order_uid, + -- ETH Flow orders have trader = sender of orderCreation. + case when sender is not null then sender else trader end as trader, + sell_token_address, + case when sender is not null then 'ETH' else sell_token end as sell_token, + buy_token_address, + buy_token, + case + when lower(buy_token) > lower(sell_token) then concat(sell_token, '-', buy_token) + else concat(buy_token, '-', sell_token) + end as token_pair, + units_sold, + atoms_sold, + units_bought, + atoms_bought, + (CASE + WHEN sell_price IS NOT NULL THEN + -- Choose the larger of two prices when both not null. + CASE + WHEN buy_price IS NOT NULL and buy_price * COALESCE(units_bought,0) > sell_price * COALESCE(units_sold,0) + then buy_price * units_bought + ELSE sell_price * units_sold + END + WHEN sell_price IS NULL AND buy_price IS NOT NULL THEN buy_price * units_bought + END) as usd_value, + buy_price, + buy_price * units_bought as buy_value_usd, + sell_price, + sell_price * units_sold as sell_value_usd, + fee, + fee_atoms, + (CASE + WHEN sell_price IS NOT NULL THEN + CASE + WHEN buy_price IS NOT NULL and buy_price * COALESCE(units_bought,0) > sell_price * COALESCE(units_sold,0) + then buy_price * units_bought * fee / units_sold + ELSE sell_price * fee + END + WHEN sell_price IS NULL AND buy_price IS NOT NULL + THEN buy_price * units_bought * fee / units_sold + END) as fee_usd, + app_data, + case + when receiver = 0x0000000000000000000000000000000000000000 + then trader + else receiver + end as receiver, + limit_sell_amount, + limit_buy_amount, + valid_to, + flags, + case when (flags % 2) = 0 then 'SELL' else 'BUY' end as order_type, + bitwise_and(flags, 2) != 0 as partial_fill, + (CASE + when (flags % 2) = 0 then atoms_sold / limit_sell_amount + else atoms_bought / limit_buy_amount + end + ) as fill_proportion + FROM trades_with_token_units trades + JOIN uid_to_app_id + ON uid = trades.order_uid + AND hash=tx_hash + LEFT OUTER JOIN eth_flow_senders efs + ON trades.order_uid = efs.order_uid +) + +select *, + -- Relative surplus (in %) is the difference between limit price and executed price as a ratio of the limit price. + -- Absolute surplus (in USD) is relative surplus multiplied with the value of the trade + usd_value * (atoms_bought * limit_sell_amount - atoms_sold * limit_buy_amount) / (atoms_bought * limit_sell_amount) as surplus_usd +from valued_trades diff --git a/dbt_subprojects/dex/models/_projects/cow_protocol/cow_protocol_trades.sql b/dbt_subprojects/dex/models/_projects/cow_protocol/cow_protocol_trades.sql index aa731eafcf3..1b76dbdc8f0 100644 --- a/dbt_subprojects/dex/models/_projects/cow_protocol/cow_protocol_trades.sql +++ b/dbt_subprojects/dex/models/_projects/cow_protocol/cow_protocol_trades.sql @@ -96,4 +96,34 @@ FROM trace_address, evt_index FROM {{ ref('cow_protocol_arbitrum_trades') }} + + UNION ALL + + + SELECT + 'base' AS blockchain, + 'cow_protocol' AS project, + '1' AS version, + block_date, + block_month, + block_time, + buy_token AS token_bought_symbol, + sell_token AS token_sold_symbol, + token_pair, + units_bought AS token_bought_amount, + units_sold AS token_sold_amount, + atoms_bought AS token_bought_amount_raw, + atoms_sold AS token_sold_amount_raw, + usd_value AS amount_usd, + buy_token_address AS token_bought_address, + sell_token_address AS token_sold_address, + trader AS taker, + CAST(NULL AS VARBINARY) AS maker, + project_contract_address, + tx_hash, + trader AS tx_from, + receiver AS tx_to, + trace_address, + evt_index + FROM {{ ref('cow_protocol_base_trades') }} ) diff --git a/sources/_subprojects_outputs/dex/_sources.yml b/sources/_subprojects_outputs/dex/_sources.yml index 82f13efac55..c99a0f0dd97 100644 --- a/sources/_subprojects_outputs/dex/_sources.yml +++ b/sources/_subprojects_outputs/dex/_sources.yml @@ -62,10 +62,10 @@ sources: - name: balancer_v2_pools_optimism - name: balancer_v2_pools_polygon - name: balancer_v2_pools_zkevm - - name: balancer_cowswap_amm_pools + - name: balancer_cowswap_amm_pools - name: balancer_v3_pools_ethereum - name: balancer_v3_pools_gnosis - - name: balancer_v3_pools + - name: balancer_v3_pools - name: uniswap_v3_optimism tables: - name: ovm1_pool_mapping @@ -78,9 +78,12 @@ sources: - name: cow_protocol_arbitrum tables: - name: trades + - name: cow_protocol_base + tables: + - name: trades - name: jelly_swap tables: - - name: trades + - name: trades - name: beethoven_x tables: - - name: trades + - name: trades diff --git a/sources/cow_protocol/base/cow_protocol_base_sources.yml b/sources/cow_protocol/base/cow_protocol_base_sources.yml new file mode 100644 index 00000000000..23b8894756e --- /dev/null +++ b/sources/cow_protocol/base/cow_protocol_base_sources.yml @@ -0,0 +1,160 @@ +version: 2 + +sources: + - name: gnosis_protocol_v2_base + description: "Base Chain decoded tables related to CoW Protocol contract" + tables: + - name: GPv2AllowListAuthentication_evt_SolverAdded + description: "GPv2AllowListAuthentication list of events when a Solver was added" + columns: + - &solver + name: solver + description: "Solver wallet address" + - &contract_address + name: contract_address + description: "Base address of contract emitting the event" + - &evt_block_number + name: evt_block_number + description: "Block number which processed the unique transaction hash" + - &evt_block_time + name: evt_block_time + description: "Timestamp for block event time in UTC" + - &evt_index + name: evt_index + description: "Index of the event within transaction" + - &evt_tx_hash + name: evt_tx_hash + description: "Primary key of the transaction" + data_tests: + - not_null + - name: GPv2AllowListAuthentication_evt_SolverRemoved + description: "GPv2AllowListAuthentication list of events when a solver was removed" + columns: + - *solver + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - name: GPv2Settlement_evt_Trade + description: "Trade events emitted by GPv2Settlement" + columns: + - &feeAmount + name: feeAmount + description: "Amount (in sell token) in atoms of the trade fee" + - &buyAmount + name: buyAmount + description: "Amount (in atoms) of the buyToken bought" + - &buyToken + name: buyToken + description: "Contract address of token obtained in trade. 0xeee...ee represents native asset ETH" + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - &orderUid + name: orderUid + description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." + - &owner + name: owner + description: "Owner of the order being traded (aka trader address)" + - &sellAmount + name: sellAmount + description: "Amount in atoms of the sellToken sold" + - &sellToken + name: sellToken + description: "Contract address of token sold in trade." + - name: GPv2Settlement_call_settle + description: "Contains all calls to the settle method of GPv2Settlement (both successful and failed)" + columns: + - &call_block_number + name: call_block_number + description: "Block number on which the method was called" + - &call_block_time + name: call_block_time + description: "UTC timestamp at which the method was called" + - &call_success + name: call_success + description: "Whether or not the call resulted in a successful transaction" + - &call_trace_address + name: call_trace_address + description: "Trace address of the call" + - &call_tx_hash + name: call_tx_hash + description: "Transaction hash of call (if successful, will result in a real transaction hash)." + - &clearingPrices + name: clearingPrices + description: "An array of relative token prices (matched with `tokens` by index)" + - *contract_address + - &interactions + name: interactions + description: "An array of internal contract interactions" + - &tokens + name: tokens + description: "An array of token addresses (to be matched by index on `clearingPrices`)" + - &trades + name: trades + description: "An array of order data for the trades being executed" + - name: GPv2Settlement_evt_Settlement + description: "Settlement events emitted by GPv2Settlement" + columns: + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - *solver + - name: GPv2Settlement_evt_Interaction + description: "Contract Interaction events emitted by GPv2Settlement" + columns: + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - &selector + name: selector + description: Method ID of the contract being interacted with + - &target + name: target + description: Target contract address of the interaction + - &value + name: value + description: ETH amount (in WEI) being passed into contract interaction + - name: cow_protocol_base + description: "Base decoded tables related to CoW Protocol contract's" + tables: + - name: CoWSwapEthFlow_evt_OrderPlacement + description: "CoWSwapEthFlow Order Placement Events" + columns: + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - &order + name: order + description: "Contains json encoded data for an EthFlowOrder: https://github.com/cowprotocol/ethflowcontract/blob/main/src/libraries/EthFlowOrder.sol#L19-L45" + - &data + name: data + description: "Hex Encoded data containing quoteId and validTo: https://github.com/cowprotocol/ethflowcontract/blob/9c74c8ba36ff9ff3e255172b02454f831c066865/src/CoWSwapEthFlow.sol#L110-L113" + - &sender + name: sender + description: "User who placed the order" + - &signature + name: signature + description: "Onchain EIP1271 signature" + - name: CoWSwapEthFlow_call_createOrder + description: "CoWSwapEthFlow createOrder function calls with input parameters and return value" + columns: + - *call_block_number + - *call_block_time + - *call_success + - *call_trace_address + - *call_tx_hash + - *contract_address + - *order + - &output_orderHash + name: output_orderHash + description: "ETH Flow Order Hash corresponds directly to a GPv2 Order Uid by concatenation with owner = contract_address and validTo = `ffffffff`" From 9f09723151a3c52f948f2acc20101ddf85d9616c Mon Sep 17 00:00:00 2001 From: Peter <157015397+safeintern@users.noreply.github.com> Date: Fri, 13 Dec 2024 04:03:46 +0800 Subject: [PATCH 07/32] Changed activity_start_date for Ronin Safes (#7313) --- .../models/_project/safe/ronin/safe_ronin_safes.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_safes.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_safes.sql index ac8b5622cdf..1e16b748588 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_safes.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_safes.sql @@ -16,7 +16,7 @@ ) }} -{% set project_start_date = '2024-06-30' %} +{% set project_start_date = '2021-01-01' %} select 'ronin' as blockchain, From 0d95fe07cc9dba562daff16b33a38ab31403bb37 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:04:22 +0000 Subject: [PATCH 08/32] fix next_change field on balancer_v3_erc4626_token_prices (#7303) * fix next_change field on balancer_v3_erc4626_token_prices * force run of gnosis liquidity * final * force run of gnosis liquidity * force rerun of balancer_v3_erc4626_token_prices.sql * remove unnecessary files --- .../ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql | 2 +- .../ethereum/balancer_v3_ethereum_erc4626_token_prices.sql | 2 +- .../gnosis/balancer_v3_gnosis_erc4626_token_mapping.sql | 2 +- .../gnosis/balancer_v3_gnosis_erc4626_token_prices.sql | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql index dddfbb06938..5d00d403603 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql @@ -1,7 +1,7 @@ {{ config( schema = 'balancer_v3_ethereum', - alias = 'erc4626_tokens_mapping', + alias = 'erc4626_token_mapping', materialized = 'table', file_format = 'delta' ) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql index 99f9c1acac8..e00a572b011 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql @@ -60,6 +60,6 @@ SELECT underlying_token_symbol, decimals, APPROX_PERCENTILE(adjusted_price, 0.5) AS median_price, - LEAD(DATE_TRUNC('day', p.evt_block_time), 1, NOW()) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change + LEAD(p.evt_block_time, 1, CURRENT_DATE + INTERVAL '1' day) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change FROM price_join p GROUP BY 1, 2, 3, 4, 5, 6, 7 \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_mapping.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_mapping.sql index 697c6133ebb..66d94189050 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_mapping.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_mapping.sql @@ -1,7 +1,7 @@ {{ config( schema = 'balancer_v3_gnosis', - alias = 'erc4626_tokens_mapping', + alias = 'erc4626_token_mapping', materialized = 'table', file_format = 'delta' ) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql index 9c19ed2da74..34fced964c3 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql @@ -60,6 +60,6 @@ SELECT underlying_token_symbol, decimals, APPROX_PERCENTILE(adjusted_price, 0.5) AS median_price, - LEAD(DATE_TRUNC('day', p.evt_block_time), 1, NOW()) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change + LEAD(p.evt_block_time, 1, CURRENT_DATE + INTERVAL '1' day) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change FROM price_join p GROUP BY 1, 2, 3, 4, 5, 6, 7 \ No newline at end of file From a4018d671e2fe67c7f264c1223dafadb78d26912 Mon Sep 17 00:00:00 2001 From: hildobby Date: Thu, 12 Dec 2024 21:04:41 +0100 Subject: [PATCH 09/32] add swell (#7300) Co-authored-by: Huang Geyang --- .../models/_sector/blobs/ethereum/blobs_submitters.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql b/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql index 765e3e7e0c0..4542d4d8391 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql @@ -77,4 +77,5 @@ SELECT address , (0xb6cf39ee72e0127e6ea6059e38b8c197227a6ac7, 'Morph', 'MorphL2') , (0x2986bf308d0684ad77cd32ee1c60429e6573b5af, 'R0AR Chain', 'th3r0ar') , (0x2f60a5184c63ca94f82a27100643dbabe4f3f7fd, 'Unichain', 'unichain') + , (0xf854cd5b26bfd73d51236c0122798907ed65b1f2, 'Swell', 'swellnetworkio') ) AS x(address, entity, x_username) \ No newline at end of file From 4a768fedb81f330fef4c34c75b5134f2fd15753f Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:04:58 +0000 Subject: [PATCH 10/32] update balancer.token_whitelist (#7304) --- .../_project/balancer/support/balancer_token_whitelist.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql index 5727e1a0739..a063cb927cd 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql @@ -29,6 +29,8 @@ WITH whitelist_token as ( (0xe91d153e0b41518a2ce8dd3d7944fa863463a97d, 'WXDAI', 'gnosis'), (0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1, 'WETH', 'gnosis'), (0x6c76971f98945ae98dd7d4dfca8711ebea946ea6, 'WSTETH', 'gnosis'), + (0xaf204776c7245bf4147c2612bf6e5972ee483701, 'SDAI', 'gnosis'), + (0x9c58bacc331c9aa871afd802db6379a98e80cedb, 'GNO', 'gnosis'), (0xdAC17F958D2ee523a2206206994597C13D831ec7, 'USDT', 'ethereum'), (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, 'USDC', 'ethereum'), (0x6B175474E89094C44Da98b954EedeAC495271d0F, 'DAI', 'ethereum'), From 92948fd8dac0d3fff80b1b6d25d4a52cbcc6a8e9 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Thu, 12 Dec 2024 20:05:13 +0000 Subject: [PATCH 11/32] Update tokens_ethereum_erc20.sql (#7306) * Update tokens_ethereum_erc20.sql * Update tokens_ethereum_erc20.sql --- .../tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index 141f98c1e86..56a77d10618 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4736,5 +4736,7 @@ FROM (VALUES , ( 0x358d94b5b2F147D741088803d932Acb566acB7B6, 'rSWELL', 18) , ( 0x9Ed15383940CC380fAEF0a75edacE507cC775f22, 'earnETH', 18) , ( 0x66E47E6957B85Cf62564610B76dD206BB04d831a, 'earnBTC', 8) - , (0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6, 'apxETH', 18) + , ( 0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6, 'apxETH', 18) + , ( 0xa4f6b2cdcb67bf8f48baa459a333d2667aa4b100, 'shezETH', 8) + , ( 0x7F4B66FF703336CfC35b901144614496Ae0b0D27, 'shezUSD', 18) ) AS temp_table (contract_address, symbol, decimals) From bf8b448233c1169ac2d62b22f3ce2c106f4d31c1 Mon Sep 17 00:00:00 2001 From: Phu <33654804+lequangphu@users.noreply.github.com> Date: Fri, 13 Dec 2024 03:05:43 +0700 Subject: [PATCH 12/32] Bridges of Bungee = {contract: SocketGateway, event: SocketBridge} (#7255) * Add Odos on Arbitrum to dex_aggregator * Change to WETH address on Arbitrum * Add sources of Odos on Arbitrum * Add odos/arbitrum seeds * Change data type * Add bridges of LiFi across chains * replace tests which is deprecated * fix name error of avalanche source * add index to unique test * fix concat issue * fix unique test of the main model * try to fix unique key * use surrogate key for data tests * use generate_surrogate_key inside the models * fix and remove redundant schema properties * data_tests * move generate_surrogate_key to schema.yml * 1. create macro lifi_extract_bridge_data_macro.sql and apply it in the models 2. update the models' config 3. flip materialization strategy * data_ again * fix naming of the main model * replace avalanche with avalanche_c * avalanche_c again * 1. add block_date column to the macro to use it in the add_tx_columns macro 2. update model of avalanche_c * rename columns to use add_tx_columns macro * remove evt_ * a few minor changes * add amount_usd column * data_tests again * map native token to wrapped token to avoid null price data * update the main model and schema * move type conversion from models to macro * fix source name * varbinary type doesn't need single quotes * correct collumn name * add post_hook * feat: add bungee bridges * create macro and models for each chain * add macro for bungee bridges * chore: ignore raw.sql * add amount_usd to bungee models * remove syntax error * add bungee sources * add post hook for bungee bridges * change eth address on the chains * change the main model * remove endfor * add for loop --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../bungee/bungee_SocketBridge_macro.sql | 23 ++++ .../arbitrum/bungee_arbitrum_bridges.sql | 42 +++++++ .../bungee_avalanche_c_bridges.sql | 42 +++++++ .../bungee/base/bungee_base_bridges.sql | 42 +++++++ .../bungee/blast/bungee_blast_bridges.sql | 42 +++++++ .../bungee/bnb/bungee_bnb_bridges.sql | 42 +++++++ .../_projects/bungee/bungee_bridges.sql | 46 +++++++ .../ethereum/bungee_ethereum_bridges.sql | 42 +++++++ .../bungee/fantom/bungee_fantom_bridges.sql | 42 +++++++ .../bungee/gnosis/bungee_gnosis_bridges.sql | 42 +++++++ .../bungee/linea/bungee_linea_bridges.sql | 42 +++++++ .../bungee/mantle/bungee_mantle_bridges.sql | 42 +++++++ .../optimism/bungee_optimism_bridges.sql | 42 +++++++ .../bungee/polygon/bungee_polygon_bridges.sql | 42 +++++++ .../models/_projects/bungee/schema.yml | 101 +++++++++++++++ .../bungee/scroll/bungee_scroll_bridges.sql | 42 +++++++ .../bungee/zkevm/bungee_zkevm_bridges.sql | 42 +++++++ .../bungee/zksync/bungee_zksync_bridges.sql | 42 +++++++ sources/bungee/sources.yml | 116 ++++++++++++++++++ 19 files changed, 916 insertions(+) create mode 100644 dbt_subprojects/daily_spellbook/macros/project/bungee/bungee_SocketBridge_macro.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/arbitrum/bungee_arbitrum_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/avalanche_c/bungee_avalanche_c_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/base/bungee_base_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/blast/bungee_blast_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/bnb/bungee_bnb_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/ethereum/bungee_ethereum_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/fantom/bungee_fantom_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/gnosis/bungee_gnosis_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/linea/bungee_linea_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/mantle/bungee_mantle_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/optimism/bungee_optimism_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/polygon/bungee_polygon_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/schema.yml create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/scroll/bungee_scroll_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/zkevm/bungee_zkevm_bridges.sql create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/bungee/zksync/bungee_zksync_bridges.sql create mode 100644 sources/bungee/sources.yml diff --git a/dbt_subprojects/daily_spellbook/macros/project/bungee/bungee_SocketBridge_macro.sql b/dbt_subprojects/daily_spellbook/macros/project/bungee/bungee_SocketBridge_macro.sql new file mode 100644 index 00000000000..93a0a13dbd5 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/macros/project/bungee/bungee_SocketBridge_macro.sql @@ -0,0 +1,23 @@ +{% macro bungee_SocketBridge(blockchain) %} + +select + contract_address, + evt_tx_hash, + evt_index, + evt_block_time, + evt_block_number, + amount, + token, + toChainId, + bridgeName, + sender, + receiver, + metadata, + '{{ blockchain }}' as source_chain, + {{ dbt_utils.generate_surrogate_key(['evt_tx_hash', 'evt_index']) }} as transfer_id +from {{ source('socket_v2_' ~ blockchain, 'SocketGateway_evt_SocketBridge') }} +{% if is_incremental() %} +where {{ incremental_predicate('evt_block_time') }} +{% endif %} + +{% endmacro %} diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/arbitrum/bungee_arbitrum_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/arbitrum/bungee_arbitrum_bridges.sql new file mode 100644 index 00000000000..f8ca6d45091 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/arbitrum/bungee_arbitrum_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_arbitrum', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('arbitrum') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 -- WETH on Arbitrum + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'arbitrum' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/avalanche_c/bungee_avalanche_c_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/avalanche_c/bungee_avalanche_c_bridges.sql new file mode 100644 index 00000000000..ec26a230726 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/avalanche_c/bungee_avalanche_c_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_avalanche_c', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('avalanche_c') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7 -- WAVAX + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'avalanche_c' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/base/bungee_base_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/base/bungee_base_bridges.sql new file mode 100644 index 00000000000..7220bb9b57b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/base/bungee_base_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_base', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('base') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x4200000000000000000000000000000000000006 -- WETH on Base + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'base' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/blast/bungee_blast_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/blast/bungee_blast_bridges.sql new file mode 100644 index 00000000000..b19a68e3771 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/blast/bungee_blast_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_blast', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('blast') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x4300000000000000000000000000000000000004 -- WETH on Blast + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'blast' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/bnb/bungee_bnb_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/bnb/bungee_bnb_bridges.sql new file mode 100644 index 00000000000..2feb8870be3 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/bnb/bungee_bnb_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_bnb', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('bnb') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c -- WBNB + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'bnb' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql new file mode 100644 index 00000000000..5e716870189 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql @@ -0,0 +1,46 @@ +{{ + config( + schema = 'bungee', + alias = 'bridges', + materialized = 'view', + post_hook = '{{ expose_spells(\'[ + "ethereum", "zkevm", "scroll", "blast", "linea", "mantle", "optimism", + "gnosis", "arbitrum", "zksync", "base", "bnb", "polygon", + "avalanche_c", "fantom" + ]\', + "project", "bungee", \'["lequangphu"]\') }}' + ) +}} + +{% set chains = [ + 'ethereum', 'zkevm', 'scroll', 'blast', 'linea', 'mantle', 'optimism', + 'gnosis', 'arbitrum', 'zksync', 'base', 'bnb', 'polygon', + 'avalanche_c', 'fantom' +] %} + +with bungee_bridges as ( + {% for chain in chains %} + select + contract_address, + evt_tx_hash, + evt_index, + evt_block_time, + evt_block_number, + amount, + token, + toChainId, + bridgeName, + sender, + receiver, + metadata, + source_chain, + transfer_id + from {{ ref( 'bungee_' ~ chain ~ '_bridges' ) }} + {% if not loop.last %} + union all + {% endif %} + {% endfor %} +) + +select * +from bungee_bridges \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/ethereum/bungee_ethereum_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/ethereum/bungee_ethereum_bridges.sql new file mode 100644 index 00000000000..31b632b2ae7 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/ethereum/bungee_ethereum_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_ethereum', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('ethereum') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETH + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'ethereum' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/fantom/bungee_fantom_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/fantom/bungee_fantom_bridges.sql new file mode 100644 index 00000000000..bb9698e6120 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/fantom/bungee_fantom_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_fantom', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('fantom') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83 -- WFTM + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'fantom' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/gnosis/bungee_gnosis_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/gnosis/bungee_gnosis_bridges.sql new file mode 100644 index 00000000000..262891ca52a --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/gnosis/bungee_gnosis_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_gnosis', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('gnosis') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d -- WXDAI + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'gnosis' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/linea/bungee_linea_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/linea/bungee_linea_bridges.sql new file mode 100644 index 00000000000..4d22cc3b2ae --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/linea/bungee_linea_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_linea', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('linea') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f -- WETH on Linea + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'linea' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/mantle/bungee_mantle_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/mantle/bungee_mantle_bridges.sql new file mode 100644 index 00000000000..6f9cc1c609d --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/mantle/bungee_mantle_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_mantle', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('mantle') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8 -- WMNT + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'mantle' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/optimism/bungee_optimism_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/optimism/bungee_optimism_bridges.sql new file mode 100644 index 00000000000..5fd6c070d90 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/optimism/bungee_optimism_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_optimism', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('optimism') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x4200000000000000000000000000000000000006 -- WETH on Optimism + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'optimism' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/polygon/bungee_polygon_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/polygon/bungee_polygon_bridges.sql new file mode 100644 index 00000000000..e93d39768ee --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/polygon/bungee_polygon_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_polygon', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('polygon') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 -- WMATIC + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'polygon' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/schema.yml b/dbt_subprojects/daily_spellbook/models/_projects/bungee/schema.yml new file mode 100644 index 00000000000..9788cf2079a --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/schema.yml @@ -0,0 +1,101 @@ +version: 2 + +models: + - name: bungee_bridges + description: "Unified cross-chain bridges data from Bungee's Socket Bridge" + columns: &common_columns + - name: transfer_id + description: "Unique identifier for each transfer" + data_tests: + - unique + - not_null + - name: contract_address + description: "Address of the Socket Gateway contract" + - name: evt_tx_hash + description: "Transaction hash of the transfer event" + - name: evt_index + description: "Index of the event in the transaction" + - name: evt_block_time + description: "Timestamp of the block containing the transfer" + - name: evt_block_number + description: "Block number containing the transfer" + - name: amount + description: "Amount of tokens transferred" + - name: token + description: "Address of the transferred token" + - name: token_adjusted + description: "Adjusted token address (maps native token to wrapped version)" + - name: toChainId + description: "Destination chain ID" + - name: bridgeName + description: "Name of the bridge used" + - name: sender + description: "Address of the sender" + - name: receiver + description: "Address of the receiver" + - name: metadata + description: "Additional transfer metadata" + - name: source_chain + description: "Source blockchain of the transfer" + - name: amount_usd + description: "USD value of the transferred amount at the time of transfer" + + - name: bungee_ethereum_bridges + description: "Ethereum bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_zkevm_bridges + description: "zkEVM bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_scroll_bridges + description: "Scroll bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_blast_bridges + description: "Blast bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_linea_bridges + description: "Linea bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_mantle_bridges + description: "Mantle bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_optimism_bridges + description: "Optimism bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_gnosis_bridges + description: "Gnosis bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_arbitrum_bridges + description: "Arbitrum bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_zksync_bridges + description: "zkSync bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_base_bridges + description: "Base bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_bnb_bridges + description: "BNB Chain bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_polygon_bridges + description: "Polygon bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_avalanche_c_bridges + description: "Avalanche C-Chain bridges data from Bungee's Socket Bridge" + columns: *common_columns + + - name: bungee_fantom_bridges + description: "Fantom bridges data from Bungee's Socket Bridge" + columns: *common_columns \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/scroll/bungee_scroll_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/scroll/bungee_scroll_bridges.sql new file mode 100644 index 00000000000..9c3a4d3c1e3 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/scroll/bungee_scroll_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_scroll', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('scroll') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x5300000000000000000000000000000000000004 -- WETH on Scroll + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'scroll' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/zkevm/bungee_zkevm_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/zkevm/bungee_zkevm_bridges.sql new file mode 100644 index 00000000000..2759ebb201d --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/zkevm/bungee_zkevm_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_zkevm', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('zkevm') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9 -- WETH on zkEVM + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'zkevm' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/zksync/bungee_zksync_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/zksync/bungee_zksync_bridges.sql new file mode 100644 index 00000000000..367a8cefcba --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/zksync/bungee_zksync_bridges.sql @@ -0,0 +1,42 @@ +{{ + config( + schema = 'bungee_zksync', + alias = 'bridges', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['transfer_id'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +with source_data as ( + {{ bungee_SocketBridge('zksync') }} +), + +tokens_mapped as ( + select + *, + case + when token = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee + then 0x5aea5775959fbc2557cc8789bc1bf90a239d9a91 -- WETH on zkSync + else token + end as token_adjusted + from source_data +), + +price_data as ( + select + tokens_mapped.*, + p.price * amount / power(10, p.decimals) as amount_usd + from tokens_mapped + left join {{ source('prices', 'usd') }} p + on p.contract_address = tokens_mapped.token_adjusted + and p.blockchain = 'zksync' + and p.minute = date_trunc('minute', tokens_mapped.evt_block_time) + {% if is_incremental() %} + and {{ incremental_predicate('p.minute') }} + {% endif %} +) + +select * from price_data \ No newline at end of file diff --git a/sources/bungee/sources.yml b/sources/bungee/sources.yml new file mode 100644 index 00000000000..c98f528f436 --- /dev/null +++ b/sources/bungee/sources.yml @@ -0,0 +1,116 @@ +version: 2 + +sources: + - name: socket_v2_ethereum + description: "Ethereum Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: &common_columns + - name: contract_address + description: "Contract address of the Socket Gateway" + - name: evt_tx_hash + description: "Transaction hash of the event" + - name: evt_index + description: "Event index in the transaction" + - name: evt_block_time + description: "Timestamp of the block when the event was emitted" + - name: evt_block_number + description: "Block number when the event was emitted" + - name: amount + description: "Amount of tokens being bridged" + - name: token + description: "Address of the token being bridged" + - name: toChainId + description: "Destination chain ID" + - name: bridgeName + description: "Name of the bridge used" + - name: sender + description: "Address of the sender" + - name: receiver + description: "Address of the receiver" + - name: metadata + description: "Additional bridge metadata" + + - name: socket_v2_arbitrum + description: "Arbitrum Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_optimism + description: "Optimism Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_avalanche_c + description: "Avalanche C-Chain Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_bnb + description: "BNB Chain Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_polygon + description: "Polygon Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_fantom + description: "Fantom Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_gnosis + description: "Gnosis Chain Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_zksync + description: "zkSync Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_base + description: "Base Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_zkevm + description: "zkEVM Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_scroll + description: "Scroll Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_linea + description: "Linea Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_mantle + description: "Mantle Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns + + - name: socket_v2_blast + description: "Blast Socket Gateway events" + tables: + - name: SocketGateway_evt_SocketBridge + columns: *common_columns \ No newline at end of file From 5ea5c4c3d3d2b69f5ecce4beced1f1dc9454ca3b Mon Sep 17 00:00:00 2001 From: Peter <49856481+peterrliem@users.noreply.github.com> Date: Fri, 13 Dec 2024 04:06:16 +0800 Subject: [PATCH 13/32] Create NFT Ronin Transfers (#7136) * Create nft_ronin_transfers table * Update nft_transfers.sql Added Ronin * Rename nft_ronin_transfers to nft_ronin_transfers.sql * Update _schema.yml --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../nft/models/_sector/transfers/_schema.yml | 22 +++++++++++++++++ .../transfers/chains/nft_ronin_transfers.sql | 24 +++++++++++++++++++ .../_sector/transfers/nft_transfers.sql | 3 ++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/nft/models/_sector/transfers/chains/nft_ronin_transfers.sql diff --git a/dbt_subprojects/nft/models/_sector/transfers/_schema.yml b/dbt_subprojects/nft/models/_sector/transfers/_schema.yml index e28d91c834d..1c470216126 100644 --- a/dbt_subprojects/nft/models/_sector/transfers/_schema.yml +++ b/dbt_subprojects/nft/models/_sector/transfers/_schema.yml @@ -471,3 +471,25 @@ models: - *token_standard - *transfer_type - *unique_transfer_id + + - name: nft_ronin_transfers + meta: + blockchain: ronin + sector: nft + contributors: petertherock + config: + tags: [ 'nft', 'transfers' ] + description: > + NFT transfers + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - token_id + - amount + columns: + # only listing columns that have tests here for simplicity + - *token_standard + - *transfer_type + - *unique_transfer_id diff --git a/dbt_subprojects/nft/models/_sector/transfers/chains/nft_ronin_transfers.sql b/dbt_subprojects/nft/models/_sector/transfers/chains/nft_ronin_transfers.sql new file mode 100644 index 00000000000..6bd78b2fd49 --- /dev/null +++ b/dbt_subprojects/nft/models/_sector/transfers/chains/nft_ronin_transfers.sql @@ -0,0 +1,24 @@ +{{ + config( + schema="nft_ronin", + alias="transfers", + partition_by=["block_month"], + materialized="incremental", + file_format="delta", + incremental_strategy="merge", + incremental_predicates=[ + incremental_predicate("DBT_INTERNAL_DEST.block_time") + ], + unique_key=["tx_hash", "evt_index", "token_id", "amount"], + ) +}} + +{{ + nft_transfers( + blockchain="ronin", + base_transactions=source("ronin", "transactions"), + erc721_transfers=source("erc721_ronin", "evt_transfer"), + erc1155_single=source("erc1155_ronin", "evt_transfersingle"), + erc1155_batch=source("erc1155_ronin", "evt_transferbatch"), + ) +}} diff --git a/dbt_subprojects/nft/models/_sector/transfers/nft_transfers.sql b/dbt_subprojects/nft/models/_sector/transfers/nft_transfers.sql index 721069b7ae1..7f4ffc9fd75 100644 --- a/dbt_subprojects/nft/models/_sector/transfers/nft_transfers.sql +++ b/dbt_subprojects/nft/models/_sector/transfers/nft_transfers.sql @@ -8,7 +8,7 @@ incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], unique_key = ['tx_hash', 'evt_index', 'token_id', 'amount'], - post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "polygon", "fantom", "goerli", "base", "celo", "zksync", "zora", "scroll", "linea", "blast", "mantle"]\', + post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "polygon", "fantom", "goerli", "base", "celo", "zksync", "zora", "scroll", "linea", "blast", "mantle", "sei", "ronin"]\', "sector", "nft", \'["hildobby", "0xRob", "rantum","petertherock"]\') }}' @@ -34,6 +34,7 @@ ,ref('nft_blast_transfers') ,ref('nft_mantle_transfers') ,ref('nft_sei_transfers') +,ref('nft_ronin_transfers') ] %} SELECT * From 5db57d23b933c811c16ea713d8ae0ee13a3be7f2 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:50:43 +0100 Subject: [PATCH 14/32] add flag (#7327) --- dbt_subprojects/daily_spellbook/README.md | 2 +- dbt_subprojects/dex/README.md | 2 +- dbt_subprojects/tokens/dbt_project.yml | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dbt_subprojects/daily_spellbook/README.md b/dbt_subprojects/daily_spellbook/README.md index be76883e83d..284f462bfd6 100644 --- a/dbt_subprojects/daily_spellbook/README.md +++ b/dbt_subprojects/daily_spellbook/README.md @@ -1,3 +1,3 @@ ## Daily Spellbook -This is a DBT sub project for the the main models of Spellbook that runs on a daily candence. \ No newline at end of file +This is a DBT sub project for the the main models of Spellbook that runs on a daily candence. diff --git a/dbt_subprojects/dex/README.md b/dbt_subprojects/dex/README.md index 8aef6e6c3ac..f27f945ea18 100644 --- a/dbt_subprojects/dex/README.md +++ b/dbt_subprojects/dex/README.md @@ -8,4 +8,4 @@ This is a DBT subproject for the main lineages of the DEX sector. Included in th - `dex.sandwiched` - ...and more! -This subproject will be dedicated to building the above spells (and others in the future related to DEX) on an hourly cadence in production. All other spells not included within this subproject will treat these spells as sources. For example, labels spells which read from `dex.trades` will now treat the spell as a source, rather than reference within dbt. \ No newline at end of file +This subproject will be dedicated to building the above spells (and others in the future related to DEX) on an hourly cadence in production. All other spells not included within this subproject will treat these spells as sources. For example, labels spells which read from `dex.trades` will now treat the spell as a source, rather than reference within dbt. diff --git a/dbt_subprojects/tokens/dbt_project.yml b/dbt_subprojects/tokens/dbt_project.yml index 9ec35c4c768..4ab163deb41 100644 --- a/dbt_subprojects/tokens/dbt_project.yml +++ b/dbt_subprojects/tokens/dbt_project.yml @@ -14,6 +14,9 @@ quoting: # profile: "spellbook-poc-tokens" profile: "spellbook-local" +flags: + require_certificate_validation: true + vars: DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" From 4774a181eeeeba30234dcea053c1c3bbd56ec1d0 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:09:25 +0100 Subject: [PATCH 15/32] add require_certificate_validation flags (#7328) --- dbt_subprojects/daily_spellbook/dbt_project.yml | 3 +++ dbt_subprojects/dex/dbt_project.yml | 3 +++ dbt_subprojects/hourly_spellbook/dbt_project.yml | 3 +++ dbt_subprojects/nft/dbt_project.yml | 3 +++ dbt_subprojects/solana/dbt_project.yml | 3 +++ 5 files changed, 15 insertions(+) diff --git a/dbt_subprojects/daily_spellbook/dbt_project.yml b/dbt_subprojects/daily_spellbook/dbt_project.yml index 6b78c227a00..3de0a51a609 100644 --- a/dbt_subprojects/daily_spellbook/dbt_project.yml +++ b/dbt_subprojects/daily_spellbook/dbt_project.yml @@ -14,6 +14,9 @@ quoting: # profile: "spellbook-poc-tokens" profile: "spellbook-local" +flags: + require_certificate_validation: true + vars: DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '3') }}" diff --git a/dbt_subprojects/dex/dbt_project.yml b/dbt_subprojects/dex/dbt_project.yml index e7ae73c9424..5e25bae64bd 100644 --- a/dbt_subprojects/dex/dbt_project.yml +++ b/dbt_subprojects/dex/dbt_project.yml @@ -13,6 +13,9 @@ quoting: # This setting configures which "profile" dbt uses for this project. profile: "spellbook-local" +flags: + require_certificate_validation: true + vars: DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" diff --git a/dbt_subprojects/hourly_spellbook/dbt_project.yml b/dbt_subprojects/hourly_spellbook/dbt_project.yml index 401361c36c8..ce172a90410 100644 --- a/dbt_subprojects/hourly_spellbook/dbt_project.yml +++ b/dbt_subprojects/hourly_spellbook/dbt_project.yml @@ -14,6 +14,9 @@ quoting: # profile: "spellbook-poc-tokens" profile: "spellbook-local" +flags: + require_certificate_validation: true + vars: DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" diff --git a/dbt_subprojects/nft/dbt_project.yml b/dbt_subprojects/nft/dbt_project.yml index f26a684eeb9..7fd0b4eb5c3 100644 --- a/dbt_subprojects/nft/dbt_project.yml +++ b/dbt_subprojects/nft/dbt_project.yml @@ -14,6 +14,9 @@ quoting: # profile: "spellbook-poc-tokens" profile: "spellbook-local" +flags: + require_certificate_validation: true + vars: DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" diff --git a/dbt_subprojects/solana/dbt_project.yml b/dbt_subprojects/solana/dbt_project.yml index ed3a13af12f..9daa19b0fee 100644 --- a/dbt_subprojects/solana/dbt_project.yml +++ b/dbt_subprojects/solana/dbt_project.yml @@ -13,6 +13,9 @@ quoting: # This setting configures which "profile" dbt uses for this project. profile: "spellbook-local" +flags: + require_certificate_validation: true + vars: DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}" DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}" From 8bcac3953f4a40a850386d13d59072d082ec0a63 Mon Sep 17 00:00:00 2001 From: hinus <64959125+cxheng315@users.noreply.github.com> Date: Sat, 14 Dec 2024 01:45:14 +0800 Subject: [PATCH 16/32] Add apeiron token to ronin erc20 (#7323) * feat: add apeiron token to ronin erc20 * Update tokens_ronin_erc20.sql --- .../tokens/models/tokens/ronin/tokens_ronin_erc20.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/tokens/ronin/tokens_ronin_erc20.sql b/dbt_subprojects/tokens/models/tokens/ronin/tokens_ronin_erc20.sql index 52bcf26685e..d384a32bd2f 100644 --- a/dbt_subprojects/tokens/models/tokens/ronin/tokens_ronin_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/ronin/tokens_ronin_erc20.sql @@ -20,4 +20,6 @@ FROM (VALUES , (0x18d2bdef572c67127e218c425f546fe64430a92c, 'LUAUSD', 18) , (0x7eae20d11ef8c779433eb24503def900b9d28ad7, 'PIXEL', 18) , (0xd61bbbb8369c46c15868ad9263a2710aced156c4, 'LUA', 18) -) AS temp_table (contract_address, symbol, decimals) \ No newline at end of file + , (0x7894b3088d069e70895effa4e8f7d2c243fd04c1, 'APRS', 18) + , (0xf80132fc0a86add011bffce3aedd60a86e3d704d, 'ANIMA', 18) +) AS temp_table (contract_address, symbol, decimals) From e13c06e1c671366c322853c0b60c91cd8b6b7266 Mon Sep 17 00:00:00 2001 From: Eduard Horch <40689054+grkhr@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:00:25 +0100 Subject: [PATCH 17/32] Update oneinch_mapped_contracts_macro.sql (#7330) --- .../project/oneinch/_meta/oneinch_mapped_contracts_macro.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt_subprojects/daily_spellbook/macros/project/oneinch/_meta/oneinch_mapped_contracts_macro.sql b/dbt_subprojects/daily_spellbook/macros/project/oneinch/_meta/oneinch_mapped_contracts_macro.sql index fffe4792f2d..51d242c34ab 100644 --- a/dbt_subprojects/daily_spellbook/macros/project/oneinch/_meta/oneinch_mapped_contracts_macro.sql +++ b/dbt_subprojects/daily_spellbook/macros/project/oneinch/_meta/oneinch_mapped_contracts_macro.sql @@ -79,7 +79,7 @@ , ('0xbf1fc29668e5f5eaa819948599c9ac1b1e03e75f', 'true', 'Cone' , 'ConeRouter01' , ['bnb']) , ('0x11984dc4465481512eb5b777e44061c158cf2259', 'true', 'Connext' , 'ConnextDiamond' , ['polygon']) , ('0xee9dec2712cce65174b561151701bf54b99c24c8', 'true', 'Connext' , 'ConnextDiamond' , ['arbitrum']) - , ('0x9008d19f58aabd9ed0d60971565aa8510560ab41', 'true', 'CoWSwap' , 'GPv2Settlement' , ['ethereum','gnosis','arbitrum']) + , ('0x9008d19f58aabd9ed0d60971565aa8510560ab41', 'true', 'CoWSwap' , 'GPv2Settlement' , ['ethereum','gnosis','arbitrum','base']) , ('0xfa43de785dd3cd0ef3dae0dd2b8be3f1b5112d1a', 'true', 'CrossCurve' , 'UnifiedRouterV2v1' , ['ethereum','bnb','polygon','gnosis','arbitrum','avalanche_c','optimism','base','fantom']) , ('0xa2a786ff9148f7c88ee93372db8cbe9e94585c74', 'true', 'CrossCurve' , 'UnifiedRouterV2v5' , ['ethereum','bnb','polygon','gnosis','arbitrum','avalanche_c','optimism','base','fantom','blast','linea','mantle']) , ('0xe7db62c7960183895190274f26925388db4a3be4', 'true', 'CrossCurve' , 'UnifiedRouterV2' , ['ethereum','bnb','polygon','gnosis','arbitrum','avalanche_c','optimism','base','fantom']) From 2d7e97a76135f0f7d2348b0a05ef39b8672c2836 Mon Sep 17 00:00:00 2001 From: Phu <33654804+lequangphu@users.noreply.github.com> Date: Sat, 14 Dec 2024 02:02:34 +0700 Subject: [PATCH 18/32] Continue work of PR #7255, add amount_usd to the main model (#7325) * Add Odos on Arbitrum to dex_aggregator * Change to WETH address on Arbitrum * Add sources of Odos on Arbitrum * Add odos/arbitrum seeds * Change data type * Add bridges of LiFi across chains * replace tests which is deprecated * fix name error of avalanche source * add index to unique test * fix concat issue * fix unique test of the main model * try to fix unique key * use surrogate key for data tests * use generate_surrogate_key inside the models * fix and remove redundant schema properties * data_tests * move generate_surrogate_key to schema.yml * 1. create macro lifi_extract_bridge_data_macro.sql and apply it in the models 2. update the models' config 3. flip materialization strategy * data_ again * fix naming of the main model * replace avalanche with avalanche_c * avalanche_c again * 1. add block_date column to the macro to use it in the add_tx_columns macro 2. update model of avalanche_c * rename columns to use add_tx_columns macro * remove evt_ * a few minor changes * add amount_usd column * data_tests again * map native token to wrapped token to avoid null price data * update the main model and schema * move type conversion from models to macro * fix source name * varbinary type doesn't need single quotes * correct collumn name * add post_hook * feat: add bungee bridges * create macro and models for each chain * add macro for bungee bridges * chore: ignore raw.sql * add amount_usd to bungee models * remove syntax error * add bungee sources * add post hook for bungee bridges * change eth address on the chains * change the main model * remove endfor * add for loop * add amount_usd to the main model --------- Co-authored-by: Huang Geyang Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../daily_spellbook/models/_projects/bungee/bungee_bridges.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql b/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql index 5e716870189..b2605abd834 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/bungee/bungee_bridges.sql @@ -34,7 +34,8 @@ with bungee_bridges as ( receiver, metadata, source_chain, - transfer_id + transfer_id, + amount_usd from {{ ref( 'bungee_' ~ chain ~ '_bridges' ) }} {% if not loop.last %} union all From 025892fb53df7fd30090fa625057f9643f590836 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Fri, 13 Dec 2024 20:15:35 +0100 Subject: [PATCH 19/32] Balance improvements (#7290) * move safe balance models * add incremental to balances and use daily prices table --- .../balances_incremental_subset_daily.sql | 12 +- .../_projects/safe/balances/_schema.yml | 123 ++++++++++++++++++ .../safe/balances}/safe_arbitrum_balances.sql | 2 +- .../balances}/safe_avalanche_c_balances.sql | 2 +- .../safe/balances}/safe_base_balances.sql | 2 +- .../safe/balances}/safe_ethereum_balances.sql | 2 +- .../safe/balances}/safe_linea_balances.sql | 2 +- .../safe/balances}/safe_optimism_balances.sql | 2 +- .../safe/balances}/safe_polygon_balances.sql | 2 +- .../safe/balances}/safe_scroll_balances.sql | 2 +- .../safe/arbitrum/safe_arbitrum_schema.yml | 46 ------- .../avalanche_c/safe_avalanche_c_schema.yml | 48 +------ .../_project/safe/base/safe_base_schema.yml | 46 ------- .../models/_project/safe/ethereum/_schema.yml | 48 ------- .../_project/safe/linea/safe_linea_schema.yml | 48 +------ .../safe/optimism/safe_optimism_schema.yml | 45 ------- .../safe/polygon/safe_polygon_schema.yml | 49 +------ .../safe/scroll/safe_scroll_schema.yml | 46 ------- .../hourly_spellbook/_sources.yml | 25 +++- 19 files changed, 165 insertions(+), 387 deletions(-) create mode 100644 dbt_subprojects/daily_spellbook/models/_projects/safe/balances/_schema.yml rename dbt_subprojects/{hourly_spellbook/models/_project/safe/arbitrum => daily_spellbook/models/_projects/safe/balances}/safe_arbitrum_balances.sql (95%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/avalanche_c => daily_spellbook/models/_projects/safe/balances}/safe_avalanche_c_balances.sql (94%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/base => daily_spellbook/models/_projects/safe/balances}/safe_base_balances.sql (95%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/ethereum => daily_spellbook/models/_projects/safe/balances}/safe_ethereum_balances.sql (95%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/linea => daily_spellbook/models/_projects/safe/balances}/safe_linea_balances.sql (95%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/optimism => daily_spellbook/models/_projects/safe/balances}/safe_optimism_balances.sql (96%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/polygon => daily_spellbook/models/_projects/safe/balances}/safe_polygon_balances.sql (95%) rename dbt_subprojects/{hourly_spellbook/models/_project/safe/scroll => daily_spellbook/models/_projects/safe/balances}/safe_scroll_balances.sql (95%) diff --git a/dbt_macros/shared/balances_incremental_subset_daily.sql b/dbt_macros/shared/balances_incremental_subset_daily.sql index 9e330747b25..d397380b258 100644 --- a/dbt_macros/shared/balances_incremental_subset_daily.sql +++ b/dbt_macros/shared/balances_incremental_subset_daily.sql @@ -149,14 +149,18 @@ from( {% endif %} ) b -left join {{source('prices','usd')}} p - on (token_standard = 'erc20' +left join {{source('prices','usd_daily')}} p + on 1=1 + {% if is_incremental() %} + and {{ incremental_predicate('p.day') }} + {% endif %} + and ((token_standard = 'erc20' and p.blockchain = '{{blockchain}}' and b.token_address = p.contract_address - and b.day = p.minute) + and b.day = p.day) or (token_standard = 'native' and p.blockchain is null and p.contract_address is null and p.symbol = (select native_token_symbol from {{source('evms','info')}} where blockchain = '{{blockchain}}') - and b.day = p.minute) + and b.day = p.day)) {% endmacro %} diff --git a/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/_schema.yml b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/_schema.yml new file mode 100644 index 00000000000..26d00f99e5b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/_schema.yml @@ -0,0 +1,123 @@ +version: 2 + +models: + - name: safe_arbitrum_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: arbitrum + project: safe + contributors: safeintern + config: + tags: ['safe', 'arbitrum'] + description: “Safe addresses balances” + + - name: safe_avalanche_c_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: avalanche_c + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'avalanche_c' ] + description: “Safe addresses balances” + + - name: safe_base_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: base + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'base' ] + description: “Safe addresses balances” + + - name: safe_ethereum_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: ethereum + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'ethereum' ] + description: “Safe addresses balances” + + - name: safe_linea_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: linea + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'linea' ] + description: “Safe addresses balances” + + - name: safe_optimism_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: optimism + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'optimism' ] + description: “Safe addresses balances” + + - name: safe_polygon_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: polygon + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'polygon' ] + description: “Safe addresses balances” + + - name: safe_scroll_balances + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + meta: + blockchain: scroll + project: safe + contributors: safeintern + config: + tags: [ 'safe', 'scroll' ] + description: “Safe addresses balances” + diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_arbitrum_balances.sql similarity index 95% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_arbitrum_balances.sql index 56d1fe4895b..9c5b0f9816d 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_arbitrum_balances.sql @@ -15,7 +15,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_arbitrum_safes') }} + from {{ source('safe_arbitrum','safes') }} where blockchain = 'arbitrum' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_avalanche_c_balances.sql similarity index 94% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_avalanche_c_balances.sql index 432cd070a0a..33279643d65 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_avalanche_c_balances.sql @@ -15,7 +15,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_avalanche_c_safes') }} + from {{ source('safe_avalanche_c','safes') }} where blockchain = 'avalanche_c' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_base_balances.sql similarity index 95% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_base_balances.sql index 84aeba4f700..44e45138e77 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_base_balances.sql @@ -15,7 +15,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_base_safes') }} + from {{ source('safe_base','safes') }} where blockchain = 'base' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/safe_ethereum_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_ethereum_balances.sql similarity index 95% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/safe_ethereum_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_ethereum_balances.sql index ebc7a430771..e681bf730d2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/safe_ethereum_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_ethereum_balances.sql @@ -14,7 +14,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_ethereum_safes') }} + from {{ source('safe_ethereum','safes') }} where blockchain = 'ethereum' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_linea_balances.sql similarity index 95% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_linea_balances.sql index 038ed2990d5..de62451a1e4 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_linea_balances.sql @@ -15,7 +15,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_linea_safes') }} + from {{ source('safe_linea','safes') }} where blockchain = 'linea' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_optimism_balances.sql similarity index 96% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_optimism_balances.sql index 2465f2a8d65..8338b3be28c 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_optimism_balances.sql @@ -20,7 +20,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_optimism_safes') }} + from {{ source('safe_optimism','safes') }} where blockchain = 'optimism' ), balances as ( diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_polygon_balances.sql similarity index 95% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_polygon_balances.sql index 5c62beac340..de7eb4a6d7a 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_polygon_balances.sql @@ -15,7 +15,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_polygon_safes') }} + from {{ source('safe_polygon','safes') }} where blockchain = 'polygon' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_balances.sql b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_scroll_balances.sql similarity index 95% rename from dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_balances.sql rename to dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_scroll_balances.sql index 5c4389542bb..4cf40377e92 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_balances.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/safe/balances/safe_scroll_balances.sql @@ -15,7 +15,7 @@ with safes as ( select address, blockchain - from {{ ref('safe_scroll_safes') }} + from {{ source('safe_scroll','safes') }} where blockchain = 'scroll' ), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml index bdda09eab40..269628b66e5 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml @@ -149,49 +149,3 @@ models: - &amount_usd name: amount_usd description: "USD amount of transferred ETH" - - - name: safe_arbitrum_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - address - - token_address - meta: - blockchain: arbitrum - project: safe - contributors: safeintern - config: - tags: ['safe', 'arbitrum'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: " unique key" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml index 629b3491f2d..9cbdd4f86d7 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml @@ -80,7 +80,7 @@ models: name: value description: "Value of transaction" - &gas - name: gas + name: gas description: "Gas limit set for transaction" - &execution_gas_used name: execution_gas_used @@ -149,49 +149,3 @@ models: - &amount_usd name: amount_usd description: "USD amount of transferred AVAX" - - - name: safe_avalanche_c_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - address - - token_address - meta: - blockchain: avalanche_c - project: safe - contributors: safeintern - config: - tags: ['safe', 'avalanche_c'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: "unique key" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml index fae0ee71228..4e73519cadc 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml @@ -141,49 +141,3 @@ models: - &output name: output description: "Output data" - - - name: safe_base_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - address - - token_address - meta: - blockchain: base - project: safe - contributors: safeintern - config: - tags: ['safe', 'base'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: " unique key" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/_schema.yml index 501fd6d00ac..ea8bb76b964 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/ethereum/_schema.yml @@ -154,51 +154,3 @@ models: - &threshold name: threshold description: "Number of signer threshold" - - - name: safe_ethereum_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - address - - token_address - - meta: - blockchain: ethereum - project: safe - contributors: safeintern - config: - tags: ['safe', 'ethereum'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: " unique key" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml index 2903c2ec94c..28ec16f2da1 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml @@ -147,50 +147,4 @@ models: - &output name: output description: "Output data" - - - - name: safe_linea_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - address - - token_address - meta: - blockchain: linea - project: safe - contributors: safeintern - config: - tags: ['safe', 'linea'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: " unique key" + diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml index f7ea3fc9a8e..ab2bcca3a16 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml @@ -149,48 +149,3 @@ models: - &amount_usd name: amount_usd description: "USD amount of transferred ETH" - - - name: safe_optimism_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - address - - token_address - meta: - blockchain: optimism - project: safe - contributors: safeintern - config: - tags: ['safe', 'optimism'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml index c65d6199675..2d30451c537 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml @@ -119,7 +119,7 @@ models: name: value description: "Value of transaction" - &gas - name: gas + name: gas description: "Gas limit set for transaction" - &execution_gas_used name: execution_gas_used @@ -151,50 +151,3 @@ models: - &output name: output description: "Output data" - - - name: safe_polygon_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - blockchain - - address - - token_address - meta: - blockchain: polygon - project: safe - contributors: safeintern - config: - tags: ['safe', 'polygon'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: " unique key" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml index 0d1ad4706e2..f33f34b7dc2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml @@ -159,49 +159,3 @@ models: - &method name: method description: "Function method" - - - name: safe_scroll_balances - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - day - - address - - token_address - meta: - blockchain: scroll - project: safe - contributors: safeintern - config: - tags: ['safe', 'scroll'] - description: “Safe addresses balances” - columns: - - name: day - - name: blockchain - - name: address - - &token_symbol - name: token_symbol - description: "Symbol for the token" - - &token_address - name: token_address - description: "Address for the token" - - &token_standard - name: token_standard - description: "Standard for the token" - - &token_id - name: token_id - description: "ID for the token" - - &balance - name: balance - description: "Balance for the user" - - &balance_usd - name: balance_usd - description: "USD value of balance for the user" - - &last_updated - name: last_updated - description: "UTC timestamp when data was last updated" - - &next_update - name: next_update - description: "UTC timestamp when data is next updated" - - &unique_key_id - name: unique_key_id - description: "unique key" diff --git a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml index 7fd30baafb7..ecf970cd3af 100644 --- a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml +++ b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml @@ -38,6 +38,27 @@ sources: - name: safe_ethereum tables: - name: safes + - name: safe_arbitrum + tables: + - name: safes + - name: safe_avalanche_c + tables: + - name: safes + - name: safe_base + tables: + - name: safes + - name: safe_linea + tables: + - name: safes + - name: safe_optimism + tables: + - name: safes + - name: safe_polygon + tables: + - name: safes + - name: safe_scroll + tables: + - name: safes - name: perpetual tables: @@ -49,7 +70,7 @@ sources: - name: jelly_swap_sei tables: - - name: pools_metrics_daily + - name: pools_metrics_daily - name: account_abstraction_erc4337 tables: @@ -61,4 +82,4 @@ sources: - name: evms tables: - - name: transaction_metrics \ No newline at end of file + - name: transaction_metrics From f0b3045e1db00be7638a4cf3324ffa40748f0d74 Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Fri, 13 Dec 2024 21:52:06 +0000 Subject: [PATCH 20/32] Update _schema for balancer models (#7331) * Update _schema.yml * Update _schema.yml * Update _schema.yml * Update balancer_v3_ethereum_erc4626_token_prices.sql * Update balancer_v3_gnosis_erc4626_token_prices.sql * Update balancer_v3_erc4626_token_prices.sql --- .../models/_project/balancer/erc4626_tokens/_schema.yml | 6 +++--- .../erc4626_tokens/balancer_v3_erc4626_token_prices.sql | 1 + .../_project/balancer/erc4626_tokens/ethereum/_schema.yml | 6 +++--- .../ethereum/balancer_v3_ethereum_erc4626_token_prices.sql | 4 +++- .../_project/balancer/erc4626_tokens/gnosis/_schema.yml | 6 +++--- .../gnosis/balancer_v3_gnosis_erc4626_token_prices.sql | 3 ++- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml index 6192f2b94b8..15203c33c6f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/_schema.yml @@ -7,7 +7,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'gnosis', 'static', 'token', 'mapping'] + tags: ['ethereum', 'gnosis', 'token', 'mapping'] description: > Mapping of ERC4626 tokens, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens. data_tests: @@ -36,7 +36,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'gnosis', 'static', 'token', 'pricing'] + tags: ['ethereum', 'gnosis', 'token', 'pricing'] description: > Pricing information for ERC4626 tokens. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price. data_tests: @@ -62,4 +62,4 @@ models: - name: median_price description: "Median price of the static token, computed over the dataset." - name: next_change - description: "Timestamp of the next expected pricing change or event affecting the price." \ No newline at end of file + description: "Timestamp of the next expected pricing change or event affecting the price." diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql index d47484c2ad3..33553280603 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/balancer_v3_erc4626_token_prices.sql @@ -8,6 +8,7 @@ ) }} + {% set balancer_models = [ ref('balancer_v3_ethereum_erc4626_token_prices'), ref('balancer_v3_gnosis_erc4626_token_prices') diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml index ae19546932e..a12e45769be 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/_schema.yml @@ -7,7 +7,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'static', 'token', 'mapping'] + tags: ['ethereum', 'token', 'mapping'] description: > Mapping of ERC4626 tokens on Ethereum, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens. data_tests: @@ -36,7 +36,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['ethereum', 'static', 'token', 'prices'] + tags: ['ethereum', 'token', 'prices'] description: > Pricing information for ERC4626 tokens on Ethereum. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price. data_tests: @@ -62,4 +62,4 @@ models: - name: median_price description: "Median price of the static token, computed over the dataset." - name: next_change - description: "Timestamp of the next expected pricing change or event affecting the price." \ No newline at end of file + description: "Timestamp of the next expected pricing change or event affecting the price." diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql index e00a572b011..02d989db3be 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_prices.sql @@ -9,6 +9,7 @@ ) }} + WITH wrap_unwrap AS( SELECT evt_block_time, @@ -62,4 +63,5 @@ SELECT APPROX_PERCENTILE(adjusted_price, 0.5) AS median_price, LEAD(p.evt_block_time, 1, CURRENT_DATE + INTERVAL '1' day) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change FROM price_join p -GROUP BY 1, 2, 3, 4, 5, 6, 7 \ No newline at end of file +GROUP BY 1, 2, 3, 4, 5, 6, 7 + diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml index 48cf7ead266..efb3ece0f2b 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/_schema.yml @@ -7,7 +7,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['gnosis', 'static', 'token', 'mapping'] + tags: ['gnosis', 'token', 'mapping'] description: > Mapping of ERC4626 tokens on gnosis, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens. data_tests: @@ -36,7 +36,7 @@ models: project: balancer contributors: viniabussafi config: - tags: ['gnosis', 'static', 'token', 'prices'] + tags: ['gnosis', 'token', 'prices'] description: > Pricing information for ERC4626 tokens on gnosis. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price. data_tests: @@ -62,4 +62,4 @@ models: - name: median_price description: "Median price of the static token, computed over the dataset." - name: next_change - description: "Timestamp of the next expected pricing change or event affecting the price." \ No newline at end of file + description: "Timestamp of the next expected pricing change or event affecting the price." diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql index 34fced964c3..f7166ea170f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/gnosis/balancer_v3_gnosis_erc4626_token_prices.sql @@ -9,6 +9,7 @@ ) }} + WITH wrap_unwrap AS( SELECT evt_block_time, @@ -62,4 +63,4 @@ SELECT APPROX_PERCENTILE(adjusted_price, 0.5) AS median_price, LEAD(p.evt_block_time, 1, CURRENT_DATE + INTERVAL '1' day) OVER (PARTITION BY wrappedToken ORDER BY p.evt_block_time) AS next_change FROM price_join p -GROUP BY 1, 2, 3, 4, 5, 6, 7 \ No newline at end of file +GROUP BY 1, 2, 3, 4, 5, 6, 7 From c7237e7c88cd59b8d2f1e59e346795218404b4f4 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:30:16 +0100 Subject: [PATCH 21/32] Auto labels and draft (#7321) * test auto labeler * fix * permissions * only do labels * try gh cli * try this * try this for labels * check repo * check auth status * set permissions at job level * syntax * simplify permissions * test auto project labels * make change in hourly * undo change in hourly * make change in solana * also set as draft/ready when labels are set * Revert "make change in solana" This reverts commit 66433397bd1acf2f89b933137157204f32ea8270. * ok this doesn't work, lets try this action * try gh cli * try this with gh api * try this * try this ID?? * enable content permissions * try gh CLI * syntax * final setup? * add readme changes to each subproject to check labels * add simple tokens readme --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .github/labeler.yml | 23 +++++++++++ .github/workflows/pr_automation.yml | 46 ++++++++++++++++++++++ dbt_subprojects/dex/README.md | 1 + dbt_subprojects/hourly_spellbook/README.md | 2 +- dbt_subprojects/nft/README.md | 2 +- dbt_subprojects/solana/README.md | 2 +- dbt_subprojects/tokens/README.md | 3 ++ 7 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/pr_automation.yml create mode 100644 dbt_subprojects/tokens/README.md diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000000..688cbc3a965 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,23 @@ +"dbt: daily": +- changed-files: + - any-glob-to-any-file: 'dbt_subprojects/daily_spellbook/**' + +"dbt: dex": +- changed-files: + - any-glob-to-any-file: 'dbt_subprojects/dex/**' + +"dbt: hourly": +- changed-files: + - any-glob-to-any-file: 'dbt_subprojects/hourly_spellbook/**' + +"dbt: nft": +- changed-files: + - any-glob-to-any-file: 'dbt_subprojects/nft/**' + +"dbt: solana": +- changed-files: + - any-glob-to-any-file: 'dbt_subprojects/solana/**' + +"dbt: tokens": +- changed-files: + - any-glob-to-any-file: 'dbt_subprojects/tokens/**' diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml new file mode 100644 index 00000000000..347e935773c --- /dev/null +++ b/.github/workflows/pr_automation.yml @@ -0,0 +1,46 @@ +name: PR automation + +on: + pull_request: + types: + - opened + - ready_for_review + - converted_to_draft + - synchronize + - labeled + +permissions: + pull-requests: write + contents: write + +jobs: + pr-automation: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.number }} + steps: + - name: Mark new PR as Draft + if: (github.event.action == 'opened' && github.event.pull_request.draft == false) + run: gh pr ready "$NUMBER" --undo + + - name: Set labels on Open + if: github.event.action == 'opened' + run: gh pr edit "$NUMBER" --add-label "WIP" + + - name: Set labels on Draft + if: github.event.action == 'converted_to_draft' + run: gh pr edit "$NUMBER" --add-label "WIP" --remove-label "ready-for-review" + + - name: Set labels on ready-for-review + if: github.event.action == 'ready_for_review' + run: gh pr edit "$NUMBER" --add-label "ready-for-review" --remove-label "WIP" + + - name: Add subproject labels + if: contains('synchronize,opened,reopened', github.event.action) + uses: actions/labeler@v5 + with: + sync-labels: true + + diff --git a/dbt_subprojects/dex/README.md b/dbt_subprojects/dex/README.md index f27f945ea18..a14c2b63f6a 100644 --- a/dbt_subprojects/dex/README.md +++ b/dbt_subprojects/dex/README.md @@ -1,5 +1,6 @@ ## DEX subproject + This is a DBT subproject for the main lineages of the DEX sector. Included in this subproject, but not limited to over time: - `dex.trades` - `dex_aggreagtor.trades` diff --git a/dbt_subprojects/hourly_spellbook/README.md b/dbt_subprojects/hourly_spellbook/README.md index ae104440a3c..3c685b43f50 100644 --- a/dbt_subprojects/hourly_spellbook/README.md +++ b/dbt_subprojects/hourly_spellbook/README.md @@ -1,3 +1,3 @@ ## Hourly Spellbook -This is a DBT sub project for the all hourly models in spellbook +This is a DBT sub project for the all hourly models in spellbook. diff --git a/dbt_subprojects/nft/README.md b/dbt_subprojects/nft/README.md index 0b38ebded01..eb055932640 100644 --- a/dbt_subprojects/nft/README.md +++ b/dbt_subprojects/nft/README.md @@ -1,3 +1,3 @@ ## Daily Spellbook -This is a DBT sub project for the all the NFT related models in spellbook. +This is a DBT sub project for the all the NFT related models in spellbook diff --git a/dbt_subprojects/solana/README.md b/dbt_subprojects/solana/README.md index 2fee156a2d1..9b3ec39f43f 100644 --- a/dbt_subprojects/solana/README.md +++ b/dbt_subprojects/solana/README.md @@ -1,3 +1,3 @@ ## Solana subproject -This is a DBT subproject for the main lineages of Solana data. \ No newline at end of file +This is a DBT subproject for the main lineages of Solana data diff --git a/dbt_subprojects/tokens/README.md b/dbt_subprojects/tokens/README.md new file mode 100644 index 00000000000..f5a7e541b34 --- /dev/null +++ b/dbt_subprojects/tokens/README.md @@ -0,0 +1,3 @@ +## Tokens subproject + +This is a DBT subproject for the main lineages of tokens data From 080521873e7fbb305fd4d0ca87772091b7d58839 Mon Sep 17 00:00:00 2001 From: 0xRob <83790096+0xRobin@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:37:41 +0100 Subject: [PATCH 22/32] set up as pul_request_target (#7338) --- .github/workflows/pr_automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml index 347e935773c..e43f95343f5 100644 --- a/.github/workflows/pr_automation.yml +++ b/.github/workflows/pr_automation.yml @@ -1,7 +1,7 @@ name: PR automation on: - pull_request: + pull_request_target: types: - opened - ready_for_review From aa33d8d412e4daf26bceb87f96d87b0801d29342 Mon Sep 17 00:00:00 2001 From: maybeyonas Date: Mon, 16 Dec 2024 16:52:54 +0530 Subject: [PATCH 23/32] [branch repeat] [swell] adding daily balances table of core swell assets (#7246) * fuck it we ball ? * dont think the previous incremental balled * trying to fix seed testing * lets try this * adding core asset balances * fix unique key * testing single seed * adding more seeds * [to be reverted] try testing only missing tokens * revert * adding missing swell assets to tokens_ethereum_erc20 * fix earnBTC decimals * add dependancy warning * add seed for earnAssets and rSWELL --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../balances_incremental_subset_daily.sql | 3 + .../swell_balances_ethereum_core_assets.sql | 58 +++++++++++++++++ .../swell_balances_ethereum_schema.yml | 63 +++++++++++++++++++ .../seeds/swell/balances/ethereum/schema.yml | 12 ++++ ...ell_balances_ethereum_core_assets_seed.csv | 8 +++ 5 files changed, 144 insertions(+) create mode 100644 dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_core_assets.sql create mode 100644 dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_schema.yml create mode 100644 dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/schema.yml create mode 100644 dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/swell_balances_ethereum_core_assets_seed.csv diff --git a/dbt_macros/shared/balances_incremental_subset_daily.sql b/dbt_macros/shared/balances_incremental_subset_daily.sql index d397380b258..a8566504dd6 100644 --- a/dbt_macros/shared/balances_incremental_subset_daily.sql +++ b/dbt_macros/shared/balances_incremental_subset_daily.sql @@ -2,6 +2,9 @@ @NOTICE this macro constructs the address level token balances table for given input table @NOTICE aka, you give lists of tokens and/or address, it generates table with daily balances of the address-token pair + + @WARN this macro has a dependancy on erc20.tokens. + @WARN if your token is not in the default list, manually add it via spellbook/dbt_subprojects/tokens/models/tokens//tokens__erc20.sql @PARAM blockchain -- blockchain name @PARAM address_list -- must have an address column, can be none if only filtering on tokens diff --git a/dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_core_assets.sql b/dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_core_assets.sql new file mode 100644 index 00000000000..66bf403601c --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_core_assets.sql @@ -0,0 +1,58 @@ +{{ + config( + schema = 'swell_balances_ethereum', + alias = 'core_assets', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['day', 'wallet_address', 'token_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], + post_hook='{{ expose_spells(\'["ethereum"]\', + "project", + "swell", + \'["maybeYonas"]\') }}' + ) +}} + +with +tokens as ( + select * from (values + (0xf951E335afb289353dc249e82926178EaC7DEd78, 'swETH', 'Swell LRT'), + (0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0, 'rswETH', 'Swell LRT'), + (0x0a6E7Ba5042B38349e437ec6Db6214AEC7B35676, 'SWELL', 'Swell LRT'), + (0x358d94b5b2F147D741088803d932Acb566acB7B6, 'rSWELL', 'Swell LRT'), + (0x9Ed15383940CC380fAEF0a75edacE507cC775f22, 'earnETH', 'Swell LRT'), + (0x66E47E6957B85Cf62564610B76dD206BB04d831a, 'earnBTC', 'Swell LRT'), + (0x8DB2350D78aBc13f5673A411D4700BCF87864dDE, 'swBTC', 'Swell LRT') + ) as t( + token_address, + symbol, + name + ) +), +balances as ( + {{ + balances_incremental_subset_daily( + blockchain = 'ethereum', + token_list = 'tokens', + start_date = '2023-04-12' + ) + }} +) + +select + -- t.name, + b.blockchain, + b.day, + b.address as wallet_address, + b.token_symbol, + b.token_address, + b.token_standard, + b.token_id, + b.balance, + b.balance_usd, + b.last_updated, + b.next_update +from balances b +-- left join tokens t +-- on b.token_address = t.token_address diff --git a/dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_schema.yml b/dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_schema.yml new file mode 100644 index 00000000000..733fd566ef0 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_schema.yml @@ -0,0 +1,63 @@ +version: 2 + +models: + - name: swell_balances_ethereum_core_assets + + meta: + blockchain: ethereum + project: swell + contributors: maybeYonas + + config: + tags: ['swell', 'restaking', 'lrt', 'lst', 'vaults', 'balances'] + description: "balances of swell asset holders" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - wallet_address + - token_address + - check_seed: + seed_file: ref('swell_balances_ethereum_core_assets_seed') + match_columns: + - blockchain + - day + - wallet_address + - token_address + check_columns: + - balance + - last_updated + columns: + - &blockchain + name: blockchain + description: "blockchain" + - &day + name: day + description: "date on which the token balance is logged" + - &wallet_address + name: wallet_address + description: "wallet address of the holder" + - &token_symbol + name: token_symbol + description: "token symbol" + - &token_address + name: token_address + description: "token address" + - &token_standard + name: token_standard + description: "standard of the token (erc20)" + - &token_id + name: token_id + description: "ID of the token" + - &balance + name: balance + description: "asset balance of the wallet" + - &balance_usd + name: balance_usd + description: "usd value of token balance of the wallet" + - &last_updated + name: last_updated + description: "UTC timestamp when balance was last updated" + - &next_update + name: next_update + description: "UTC timestamp when balance is next updated" diff --git a/dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/schema.yml b/dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/schema.yml new file mode 100644 index 00000000000..5bf343416bd --- /dev/null +++ b/dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/schema.yml @@ -0,0 +1,12 @@ +version: 2 + +seeds: + - name: swell_balances_ethereum_core_assets_seed + config: + column_types: + blockchain: varchar + day: timestamp + wallet_address: varbinary + token_address: varbinary + balance: double + last_updated: timestamp \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/swell_balances_ethereum_core_assets_seed.csv b/dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/swell_balances_ethereum_core_assets_seed.csv new file mode 100644 index 00000000000..56bd9d1d361 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/swell_balances_ethereum_core_assets_seed.csv @@ -0,0 +1,8 @@ +blockchain,day,wallet_address,token_address,balance,last_updated +ethereum,2024-08-13 00:00:00.000 UTC,0x4589Ef5d52a152C25Daa513cF43b1389Bd1f3C00,0xf951E335afb289353dc249e82926178EaC7DEd78,0.004752378895635013,2024-02-29 00:00:00.000 UTC +ethereum,2024-12-04 00:00:00.000 UTC,0xaf1ec97ea59e9052ee563e4265c39291c020e3dd,0x0a6e7ba5042b38349e437ec6db6214aec7b35676,1074.616281,2024-11-08 00:00:00.000 UTC +ethereum,2024-12-05 00:00:00.000 UTC,0x841ea52b74c94420a61d41ba790e710e1af8ee0a,0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0,0.050121577326075153,2024-11-24 00:00:00.000 UTC +ethereum,2024-08-13 00:00:00.000 UTC,0xfee2d4498085581dde097b9924e4e3544682d767,0x8db2350d78abc13f5673a411d4700bcf87864dde,0.04096165,2024-08-13 00:00:00.000 UTC +ethereum,2024-12-04 00:00:00.000 UTC,0xbdD5d655ad781FB9929BFe515EB4A50090444C21,0x9Ed15383940CC380fAEF0a75edacE507cC775f22,89.828941195874851394,2024-11-08 00:00:00.000 UTC +ethereum,2024-12-01 00:00:00.000 UTC,0x84a6a7c0674A3AA03e09c026600cb46181821f07,0x66E47E6957B85Cf62564610B76dD206BB04d831a,1,2024-11-25 00:00:00.000 UTC +ethereum,2024-12-04 00:00:00.000 UTC,0x22aA3f5D1daFfe1a9DF298e79a0CF2f98C1b92FF,0x358d94b5b2F147D741088803d932Acb566acB7B6,278707.960865665406065408,2024-12-02 00:00:00.000 UTC \ No newline at end of file From 2db18af7428c35bffb1122ce9b633c897c71010c Mon Sep 17 00:00:00 2001 From: viniabussafi <131974393+viniabussafi@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:55:35 +0000 Subject: [PATCH 24/32] update tokens_ethereum_erc20 (#7339) * update tokens_ethereum_erc20 * remove extra line * fix --- .../tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql | 1 + .../tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql b/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql index b185e8e88f4..edf8630b902 100644 --- a/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql @@ -123,4 +123,5 @@ FROM (VALUES , (0x764bfc309090e7f93edce53e5befa374cdcb7b8e, 'GRIMACE', 18) , (0xB0BDE111812EAC913b392D80D51966eC977bE3A2, 'jUSDC', 18) , (0xf3b7994e4dA53E04155057Fd61dc501599d57877, 'farmdWETHV3', 18) + , (0x521598765b0E5a4CD743f2769C06787b84617252, 'TLP', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index 56a77d10618..96bf183c18c 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4739,4 +4739,5 @@ FROM (VALUES , ( 0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6, 'apxETH', 18) , ( 0xa4f6b2cdcb67bf8f48baa459a333d2667aa4b100, 'shezETH', 8) , ( 0x7F4B66FF703336CfC35b901144614496Ae0b0D27, 'shezUSD', 18) + , ( 0xa7b66dda0d7c7c1e43d3130491216172993d163d, 'EVS', 6) ) AS temp_table (contract_address, symbol, decimals) From c134f358a522bab024ecc8e2992eb8aa10c2855f Mon Sep 17 00:00:00 2001 From: hinus <64959125+cxheng315@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:55:49 +0800 Subject: [PATCH 25/32] feat: add wstETH to trusted tokens (#7312) * feat: add wstETH to trusted tokens * Add test --------- Co-authored-by: Huang Geyang --- dbt_subprojects/tokens/models/prices/_schema.yml | 5 +++++ .../tokens/models/prices/prices_trusted_tokens.sql | 1 + 2 files changed, 6 insertions(+) diff --git a/dbt_subprojects/tokens/models/prices/_schema.yml b/dbt_subprojects/tokens/models/prices/_schema.yml index 3e50acf4bd5..0774a3dfa3f 100644 --- a/dbt_subprojects/tokens/models/prices/_schema.yml +++ b/dbt_subprojects/tokens/models/prices/_schema.yml @@ -195,6 +195,11 @@ models: config: tags: [ 'prices', 'stability' ] description: "List of trusted tokens across blockchains" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - contract_address - name: prices_usd_trusted_tokens meta: diff --git a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql index 93aacaa0d63..cb20a76eda0 100644 --- a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql @@ -67,6 +67,7 @@ WITH trusted_tokens AS ( , ('ethereum', 0x6b175474e89094c44da98b954eedeac495271d0f) , ('ethereum', 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599) , ('ethereum', 0xf939e0a03fb07f59a73314e73794be0e57ac1b4e) + , ('ethereum', 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0) -- wstETH , ('fantom', 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83) , ('flare', 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d) , ('fantom', 0x04068da6c83afcfa0e13ba15a6696662335d5b75) From 643d7b9fb12fbcdf7c5ec231bed9e33fa09770e1 Mon Sep 17 00:00:00 2001 From: maybeyonas Date: Mon, 16 Dec 2024 18:02:16 +0530 Subject: [PATCH 26/32] [fluid] adding fluid to dex.trades (#7291) * add fluid pools * minor commet * add block number filter * pool typo fixes and incremental patches * fix source name * adding fluid base trades * add post_hook * add dex source * add schema and info * fix boolean * undo dex info * re add dex info * add seeds * wel wel wel * fix seed * fix seed * incremental fix * adding version * Update dbt_subprojects/dex/models/trades/ethereum/platforms/fluid_v1_ethereum_base_trades.sql Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --------- Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../ethereum/fluid_v1_ethereum_pools.sql | 53 ++++++++++++++++ .../_projects/fluid/ethereum/schema.yml | 54 +++++++++++++++++ dbt_subprojects/dex/models/dex_info.sql | 1 + .../dex/models/trades/ethereum/_schema.yml | 19 ++++++ .../ethereum/dex_ethereum_base_trades.sql | 1 + .../fluid_v1_ethereum_base_trades.sql | 60 +++++++++++++++++++ dbt_subprojects/dex/seeds/trades/_schema.yml | 17 +++++- .../fluid_ethereum_base_trades_seed.csv | 3 + .../_sector/dex/trades/ethereum/_sources.yml | 3 + 9 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/dex/models/_projects/fluid/ethereum/fluid_v1_ethereum_pools.sql create mode 100644 dbt_subprojects/dex/models/_projects/fluid/ethereum/schema.yml create mode 100644 dbt_subprojects/dex/models/trades/ethereum/platforms/fluid_v1_ethereum_base_trades.sql create mode 100644 dbt_subprojects/dex/seeds/trades/fluid_ethereum_base_trades_seed.csv diff --git a/dbt_subprojects/dex/models/_projects/fluid/ethereum/fluid_v1_ethereum_pools.sql b/dbt_subprojects/dex/models/_projects/fluid/ethereum/fluid_v1_ethereum_pools.sql new file mode 100644 index 00000000000..f716aad3990 --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/fluid/ethereum/fluid_v1_ethereum_pools.sql @@ -0,0 +1,53 @@ +{{ + config( + schema = 'fluid_ethereum', + alias = 'pools', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['dex'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', + spell_type = "project", + spell_name = "fluid", + contributors = \'["maybeYonas", "pyor_xyz"]\') }}' + ) +}} + +{% set weth_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' %} + +with +decoded_events as ( + select + block_time, + block_number, + index as evt_index, + tx_hash, + contract_address as factory, + substr(topic1, 13) as dex, + substr(topic2, 13) as supplyToken, + substr(topic3, 13) as borrowToken, + bytearray_to_uint256(data) as dexId + from {{ source('ethereum', 'logs')}} + where topic0 = 0x3fecd5f7aca6136a20a999e7d11ff5dcea4bd675cb125f93ccd7d53f98ec57e4 + -- DexT1Deployed -> sample tx: https://etherscan.io/tx/0xabf5c0e676e69de941c283400d7ac5f47b17a09d870f225b5240522f95da501c#eventlog + and block_number > 20776998 + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +) + +select + 'ethereum' as blockchain, + 'fluid' as project, + '1' as version, + block_time, + block_number, + evt_index, + tx_hash, + factory, + dex, + case supplyToken when 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee then {{weth_address}} else supplyToken end as supply_token, + case borrowToken when 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee then {{weth_address}} else borrowToken end as borrow_token, + dexId as dex_id +from decoded_events \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/fluid/ethereum/schema.yml b/dbt_subprojects/dex/models/_projects/fluid/ethereum/schema.yml new file mode 100644 index 00000000000..8a955decee1 --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/fluid/ethereum/schema.yml @@ -0,0 +1,54 @@ +version: 2 + +models: + - name: fluid_v1_ethereum_pools + meta: + blockchain: ethereum + sector: dex + project: fluid + contributor: maybeYonas + config: + tags: ['ethereum', 'trades', 'fluid', 'dex'] + description: "fluid pools" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - dex + columns: + - &blockchain + name: blockchain + description: "blockchain where the pool is deployed" + - &project + name: project + description: "project name" + - &version + name: version + description: "project version" + - &block_time + name: block_time + description: "utc block timestamp when the pool is deployed" + - &block_number + name: block_number + description: "block number at which the pool is deployed" + - &evt_index + name: evt_index + description: "index of log emitted" + - &tx_hash + name: tx_hash + description: "hash of tx in which pool is deployed" + - &factory + name: factory + description: "factory contract deploying the pool" + - &dex + name: dex + description: "pool contract address" + - &supply_token + name: supply_token + description: "supply token" + - &borrow_token + name: borrow_token + description: "borrow token" + - &dex_id + name: dex_id + description: "nonce unique to factory and pool" + diff --git a/dbt_subprojects/dex/models/dex_info.sql b/dbt_subprojects/dex/models/dex_info.sql index 2de3399cc3c..678dbf2100d 100644 --- a/dbt_subprojects/dex/models/dex_info.sql +++ b/dbt_subprojects/dex/models/dex_info.sql @@ -192,4 +192,5 @@ FROM (VALUES , ('katana', 'Katana', 'Direct', 'AxieInfinity') , ('jetswap', 'JetSwap', 'Direct', 'Jetfuelfinance') , ('levinswap', 'Levinswap', 'Direct', 'levinswap') + , ('fluid', 'Fluid DEX', 'Direct', '0xfluid') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/dbt_subprojects/dex/models/trades/ethereum/_schema.yml b/dbt_subprojects/dex/models/trades/ethereum/_schema.yml index 9290c868bf6..5b33a0992c0 100644 --- a/dbt_subprojects/dex/models/trades/ethereum/_schema.yml +++ b/dbt_subprojects/dex/models/trades/ethereum/_schema.yml @@ -645,3 +645,22 @@ models: combination_of_columns: - tx_hash - evt_index + + - name: fluid_v1_ethereum_base_trades + meta: + blockchain: ethereum + sector: dex + project: fluid + contributors: maybeYonas, pyor_xyz + config: + tags: ["ethereum", "dex", "trades", "fluid"] + description: "fluid dex ethereum base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('fluid_ethereum_base_trades_seed') + filter: + version: 1 diff --git a/dbt_subprojects/dex/models/trades/ethereum/dex_ethereum_base_trades.sql b/dbt_subprojects/dex/models/trades/ethereum/dex_ethereum_base_trades.sql index 25e4ae0e1b8..7dc42461e0d 100644 --- a/dbt_subprojects/dex/models/trades/ethereum/dex_ethereum_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ethereum/dex_ethereum_base_trades.sql @@ -40,6 +40,7 @@ , ref('swaap_v2_ethereum_base_trades') , ref('valantis_hot_ethereum_base_trades') , ref('xchange_v2_ethereum_base_trades') + , ref('fluid_v1_ethereum_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/ethereum/platforms/fluid_v1_ethereum_base_trades.sql b/dbt_subprojects/dex/models/trades/ethereum/platforms/fluid_v1_ethereum_base_trades.sql new file mode 100644 index 00000000000..2c6008d451b --- /dev/null +++ b/dbt_subprojects/dex/models/trades/ethereum/platforms/fluid_v1_ethereum_base_trades.sql @@ -0,0 +1,60 @@ +{{ + config( + schema = 'fluid_v1_ethereum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +with +decoded_events as ( + select + '1' as version, + t.evt_block_number as block_number, + t.evt_block_time as block_time, + t.to as taker, + cast(null as varbinary) as maker, + t.amountOut as token_bought_amount_raw, + t.amountIn as token_sold_amount_raw, + case when swap0to1 + then p.borrow_token + else p.supply_token + end as token_bought_address, + case when not(swap0to1) + then p.borrow_token + else p.supply_token + end as token_sold_address, + t.contract_address as project_contract_address, + t.evt_tx_hash as tx_hash, + t.evt_index + from {{ source('fluid_ethereum', 'FluidDexT1_evt_Swap') }} t + inner join {{ ref('fluid_v1_ethereum_pools') }} p + on t.contract_address = p.dex + {% if is_incremental() %} + where {{ incremental_predicate('t.evt_block_time') }} + {% endif %} +) + + +SELECT + 'ethereum' as blockchain, + 'fluid' as project, + dexs.version, + cast(date_trunc('month', dexs.block_time) as date) as block_month, + cast(date_trunc('day', dexs.block_time) as date) as block_date, + dexs.block_time, + dexs.block_number, + dexs.token_bought_amount_raw, + dexs.token_sold_amount_raw, + dexs.token_bought_address, + dexs.token_sold_address, + dexs.taker, + dexs.maker, + dexs.project_contract_address, + dexs.tx_hash, + dexs.evt_index +FROM decoded_events dexs diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index 548192dab81..1bc3dd58d97 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4559,7 +4559,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: levinswap_gnosis_base_trades_seed config: column_types: @@ -4574,3 +4574,18 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: fluid_ethereum_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp diff --git a/dbt_subprojects/dex/seeds/trades/fluid_ethereum_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/fluid_ethereum_base_trades_seed.csv new file mode 100644 index 00000000000..79406267b36 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/fluid_ethereum_base_trades_seed.csv @@ -0,0 +1,3 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +ethereum,fluid,1,2024-12-10,0x6d3da988fdce7dec28e2e61cca6704cda8c9a42faf0a62d35f9a10765b59799c,350,0xdac17f958d2ee523a2206206994597c13d831ec7,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,21374285,99976540470,100000000000 +ethereum,fluid,1,2024-10-30,0x700f7f91ce515c42872e70ce896241c6feb4cdd3390ff40853e6131cfd9361bc,400,0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,21074822,144552151975089000000,171000000000000000000 \ No newline at end of file diff --git a/sources/_sector/dex/trades/ethereum/_sources.yml b/sources/_sector/dex/trades/ethereum/_sources.yml index d95c3bb0c06..5c63d9043bc 100644 --- a/sources/_sector/dex/trades/ethereum/_sources.yml +++ b/sources/_sector/dex/trades/ethereum/_sources.yml @@ -129,3 +129,6 @@ sources: - name: SovereignPool_evt_Swap - name: ProtocolFactory_evt_SovereignPoolDeployed - name: HOT_evt_HotSwap + - name: fluid_ethereum + tables: + - name: FluidDexT1_evt_Swap From cec63b1b1d011dc0d26f84dfba1224e2c9144e53 Mon Sep 17 00:00:00 2001 From: whale_hunter <143016036+whalehunting@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:32:23 +0100 Subject: [PATCH 27/32] fix: flokibot spellbook missing trades (#7335) * chore: add openocean aggregator trades * fix: fix table name * fix: add missing sources --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../ethereum/flokibot_ethereum_bot_trades.sql | 13 +++++++++++++ .../ethereum/openocean_ethereum_sources.yml | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 sources/openocean/ethereum/openocean_ethereum_sources.yml 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 d8991b7cbfd..767d546a6c9 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 @@ -64,12 +64,25 @@ 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_ethereum', 'OpenOceanExchangeProxy_evt_Swapped') }} + where + referrer = {{ treasury_fee_wallet_2 }} + {% 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/sources/openocean/ethereum/openocean_ethereum_sources.yml b/sources/openocean/ethereum/openocean_ethereum_sources.yml new file mode 100644 index 00000000000..7058039ffd1 --- /dev/null +++ b/sources/openocean/ethereum/openocean_ethereum_sources.yml @@ -0,0 +1,6 @@ +version: 2 + +sources: + - name: openocean_v2_ethereum + tables: + - name: OpenOceanExchangeProxy_evt_Swapped From a22be37f72c1531eb0e4aa5806b2554d674ab000 Mon Sep 17 00:00:00 2001 From: Haris Angelidakis <64154020+harisang@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:34:15 +0200 Subject: [PATCH 28/32] update furucombo name on gc and arbitrum (#7333) Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql | 4 ++-- .../cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql index 22feb72c40a..cfda80c9661 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql @@ -45,7 +45,7 @@ known_solver_metadata (address, environment, name) as ( (0xc46Ac109FDe084192BE59C24C3680D818763b0fd, 'prod', 'Gnosis_ParaSwap'), (0xD31E0CE8154Da6b8086d961eB3068Ef74C4322b6, 'prod', 'Gnosis_0x'), (0xAa224676d096B6Fc257F8C386C67d9e96e53AD59, 'prod', 'Gnosis_BalancerSOR'), - (0x5932b2c05172aAfE097CE0Fbd27d18a7d5A45eE1, 'prod', 'Furucombo'), + (0x5932b2c05172aAfE097CE0Fbd27d18a7d5A45eE1, 'prod', 'Portus'), (0x3A485742Bd85e660e72dE0f49cC27AD7a62911B5, 'prod', 'Seasolver'), (0x059aefdF9d9F47def37cF7066DA83fEB91fDd089, 'prod', 'Barter'), (0x40798d2261f8b7F11BFa73623c99C876844dD05A, 'prod', 'OpenOcean_Aggregator'), @@ -64,7 +64,7 @@ known_solver_metadata (address, environment, name) as ( (0x9C803d345615aDe1e5ae07A789968403fAc9171a, 'barn', 'Gnosis_ParaSwap'), (0x69433b336952e84Db44EF40b16B338F139B8baA1, 'barn', 'Gnosis_0x'), (0xCED55FC88186f672105712fe177374cce4861FDF, 'barn', 'Gnosis_BalancerSOR'), - (0xE376a730037D8B495864FD5ed6373BE89643cD06, 'barn', 'Furucombo'), + (0xE376a730037D8B495864FD5ed6373BE89643cD06, 'barn', 'Portus'), (0x2633bd8e5FDf7C72Aca1d291CA11bdB717A6aa3d, 'barn', 'Seasolver'), (0x7B0211286d8Dfdb717f4A2E5Fa5131eD911097e1, 'barn', 'Barter'), (0xc8371B2898FBaEeAe658f9FaeE8ddeDA24e37012, 'barn', 'OpenOcean_Aggregator'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql index dd7b75e11b0..3710ace1cd4 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql @@ -61,14 +61,14 @@ known_solver_metadata (address, environment, name) as ( (0x4930a9012e8677ae764e44f2b46af8087a1f9f8e, 'barn', 'Gnosis_BalancerSOR'), (0x8e600b399Da9c46255ccac98764987cF81837a66, 'barn', 'Enso'), (0xC8D2f12a9505a82C4f6994204f4BbF095183E63A, 'barn', 'Seasolver'), - (0x67be9614C4E0FCdA95AFC66a95B5BDAFb55fa362, 'barn', 'Furucombo'), + (0x67be9614C4E0FCdA95AFC66a95B5BDAFb55fa362, 'barn', 'Portus'), (0x53F5378A6f8bb24333aD8D68FD28816504a467b2, 'barn', 'Copium_Capital'), (0xC4dd6355Fbc6Eb108FD1C100389789C5B1A9A980, 'barn', 'Barter'), (0x4398129426Cb1377E9E10395b8dfBDa153c7Fe7D, 'barn', 'Fractal'), (0x727EB77c6f84ef148403f641aA32d75b7f6902A7, 'prod', 'Fractal'), (0x0a360134553feED49FE5eb273074d80B6e45941F, 'prod', 'Barter'), (0xb4694FE6590acd1281Dc34a966bbAE224559BaD4, 'prod', 'Copium_Capital'), - (0x227FDA1D5970dF605D785Bf5F2F8899d5fdF8624, 'prod', 'Furucombo'), + (0x227FDA1D5970dF605D785Bf5F2F8899d5fdF8624, 'prod', 'Portus'), (0xE3068acB5b5672408eADaD4417e7d3BA41D4FEBe, 'prod', 'Seasolver'), (0x12c53cdD1ef150E1cd291DD210b761acFADA6B9C, 'prod', 'Enso'), (0xf671d28fef15e5eafc21898c2814b1b4cd88bc9a, 'prod', 'Gnosis_BalancerSOR'), From 1ca58e95a657839dfe58f350593cefd607b3a615 Mon Sep 17 00:00:00 2001 From: clizzard <145153355+clizzard7@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:55:14 +0100 Subject: [PATCH 29/32] add sanji (#7337) * add sanji * fixed seed --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../_sector/dex/bot_trades/solana/_schema.yml | 22 +++ .../solana/dex_solana_bot_trades.sql | 1 + .../platforms/sanji_solana_bot_trades.sql | 152 ++++++++++++++++++ .../seeds/sanji/sanji_solana_trades_seed.csv | 21 +++ 4 files changed, 196 insertions(+) create mode 100644 dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/sanji_solana_bot_trades.sql create mode 100644 dbt_subprojects/solana/seeds/sanji/sanji_solana_trades_seed.csv diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml index bdf23c8aba1..413d474f8a0 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml @@ -733,3 +733,25 @@ models: - check_bot_trades_seed: seed_file: ref('prophetbots_solana_trades_seed') blockchain: solana + + - name: sanji_solana_bot_trades + meta: + blockchain: solana + sector: dex + project: sanji + contributors: whale_hunter + config: + tags: ["solana", "dex", "sanji", "trades"] + description: > + Sanji trades on Solana + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_id + - tx_index + - outer_instruction_index + - inner_instruction_index + - check_bot_trades_seed: + seed_file: ref('sanji_solana_trades_seed') + blockchain: solana diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql index 1432bf2fbb6..a047ad493be 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/dex_solana_bot_trades.sql @@ -38,6 +38,7 @@ , ref('bitfoot_solana_bot_trades') , ref('tradewiz_solana_bot_trades') , ref('prophetbots_solana_bot_trades') + , ref('sanji_solana_bot_trades') ] %} {% for bot in solana_trading_bot %} diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/sanji_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/sanji_solana_bot_trades.sql new file mode 100644 index 00000000000..03cc106c17b --- /dev/null +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/sanji_solana_bot_trades.sql @@ -0,0 +1,152 @@ +{{ config( + alias = 'bot_trades', + schema = 'sanji_solana', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] + ) +}} + +{% set project_start_date = '2024-11-21' %} +{% set fee_receiver_1 = '4E64WX4EARRMfHsvL4ZXbrbpiPcBUyrC62uawGofhdNN' %} +{% set wsol_token = 'So11111111111111111111111111111111111111112' %} + +WITH + allFeePayments AS ( + SELECT + tx_id, + 'SOL' AS feeTokenType, + balance_change / 1e9 AS fee_token_amount, + '{{wsol_token}}' AS fee_token_mint_address + FROM + {{ source('solana','account_activity') }} + WHERE + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + AND tx_success + AND balance_change > 0 + AND ( + address = '{{fee_receiver_1}}' + ) + ), + botTrades AS ( + SELECT + trades.block_time, + CAST(date_trunc('day', trades.block_time) AS date) AS block_date, + CAST(date_trunc('month', trades.block_time) AS date) AS block_month, + 'solana' AS blockchain, + amount_usd, + IF( + token_sold_mint_address = '{{wsol_token}}', + 'Buy', + 'Sell' + ) AS type, + token_bought_amount, + token_bought_symbol, + token_bought_mint_address AS token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_mint_address AS token_sold_address, + fee_token_amount * price AS fee_usd, + fee_token_amount, + IF(feeTokenType = 'SOL', 'SOL', symbol) AS fee_token_symbol, + fee_token_mint_address AS fee_token_address, + project, + version, + token_pair, + project_program_id AS project_contract_address, + trader_id AS user, + trades.tx_id, + tx_index, + outer_instruction_index, + inner_instruction_index + FROM + {{ ref('dex_solana_trades') }} AS trades + JOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_id + LEFT JOIN {{ source('prices', 'usd') }} AS feeTokenPrices ON ( + feeTokenPrices.blockchain = 'solana' + AND fee_token_mint_address = toBase58 (feeTokenPrices.contract_address) + AND date_trunc('minute', block_time) = minute + {% if is_incremental() %} + AND {{ incremental_predicate('minute') }} + {% else %} + AND minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + JOIN {{ source('solana','transactions') }} AS transactions ON ( + trades.tx_id = id + {% if is_incremental() %} + AND {{ incremental_predicate('transactions.block_time') }} + {% else %} + AND transactions.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + WHERE + trades.trader_id != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + {% if is_incremental() %} + AND {{ incremental_predicate('trades.block_time') }} + {% else %} + AND trades.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ), + highestInnerInstructionIndexForEachTrade AS ( + SELECT + tx_id, + outer_instruction_index, + MAX(inner_instruction_index) AS highestInnerInstructionIndex + FROM + botTrades + GROUP BY + tx_id, + outer_instruction_index + ) +SELECT + block_time, + block_date, + block_month, + 'Sanji' as bot, + blockchain, + amount_usd, + type, + token_bought_amount, + token_bought_symbol, + token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_address, + fee_usd, + fee_token_amount, + fee_token_symbol, + fee_token_address, + project, + version, + token_pair, + project_contract_address, + user, + botTrades.tx_id, + tx_index, + botTrades.outer_instruction_index, + COALESCE(inner_instruction_index, 0) AS inner_instruction_index, + IF( + inner_instruction_index = highestInnerInstructionIndex, + true, + false + ) AS is_last_trade_in_transaction +FROM + botTrades + JOIN highestInnerInstructionIndexForEachTrade ON ( + botTrades.tx_id = highestInnerInstructionIndexForEachTrade.tx_id + AND botTrades.outer_instruction_index = highestInnerInstructionIndexForEachTrade.outer_instruction_index + ) +ORDER BY + block_time DESC, + tx_index DESC, + outer_instruction_index DESC, + inner_instruction_index DESC diff --git a/dbt_subprojects/solana/seeds/sanji/sanji_solana_trades_seed.csv b/dbt_subprojects/solana/seeds/sanji/sanji_solana_trades_seed.csv new file mode 100644 index 00000000000..379c07d13cc --- /dev/null +++ b/dbt_subprojects/solana/seeds/sanji/sanji_solana_trades_seed.csv @@ -0,0 +1,21 @@ +block_time,block_date,block_month,bot,blockchain,amount_usd,type,token_bought_amount,token_bought_symbol,token_bought_address,token_sold_amount,token_sold_symbol,token_sold_address,fee_usd,fee_token_amount,fee_token_symbol,fee_token_address,project,version,token_pair,project_contract_address,user,tx_id,tx_index,outer_instruction_index,inner_instruction_index,is_last_trade_in_transaction +2024-12-15 07:06:47.000 UTC,2024-12-15,2024-12-01,Sanji,solana,2.12730476036,Sell,0.009734612,SOL,So11111111111111111111111111111111111111112,632.120372,timmy,4MH3cmHGELMSWeWsYVQJFgb9tmed26ZTUVQ3jkANpump,0.014851298800000001,0.00006796,SOL,So11111111111111111111111111111111111111112,raydium,4,timmy-SOL,a5cEyYEG1RaBTpsY1QapYKDv6ixvbD6CVkisSvT5Ufo,7rqre26G9XjaEjbwtSHCU97LoU1KY7LGAthXNDyygLUD,4GdbkGaaMWoPM14vJsNWCMQ4vpnMKzJAow2ZZEXe1BnGtzoMyBq5GfLBK8X6W1XihZBPV7x677z47DAtYvv7Qwt4,1263,5,0,true +2024-12-14 21:57:46.000 UTC,2024-12-14,2024-12-01,Sanji,solana,10.8765,Buy,108399.066862,ROJO,HANuXquoXxPQuUdWq2pSonH3GUwjfwg9wwxeP8do6bWV,0.05,SOL,So11111111111111111111111111111111111111112,0.0761355,0.00035,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-ROJO,27gMxh6F68GoctWNp3YyLhrMwaZsLzwK6WDLyVQCQUmd,FAZuZgyYsYQjkJD6o3YaVwz4MdvitFDWoA4DvWmR8mS5,62qqXEMGk6uiSLBfscjbcLP7aAPHtK7uvmUmxq5akQ7FE6eHeM5axrZk6J18Wc11GstxEdgoMEKn8akZwApXjmDM,1632,6,0,true +2024-12-13 23:30:55.000 UTC,2024-12-13,2024-12-01,Sanji,solana,1.25854035633,Sell,0.005622751,SOL,So11111111111111111111111111111111111111112,19013.576389,ipod,5wQPBazUaVtMTqtAGXYPdDSenxDqM5vJiDsEfov7pump,0.007536356100000001,0.00003367,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-ipod,A7LAumFoyJFTR8V9ChoSP8iSpquVacpZHva1oZ2JqS16,8Z4zvnXqR7bgJttHKpAP2SUa1TuzmXjqLj7pEbEzMmkd,2kgteAdXaZYthVsUoxHGmQGJKBGbgEahA4nGSaYh3eqzYVGKm6ovtm3UynpcKqSPX21Zdz6GfyEnGtUDdShRS2FB,2946,3,2,true +2024-12-07 16:58:50.000 UTC,2024-12-07,2024-12-01,Sanji,solana,190.39411413672,Sell,0.786817564,SOL,So11111111111111111111111111111111111111112,856847975790.57,DNA,DiSetnR7k57wmfvywJhUVjPwWfg54SdQKxQdJEBYW23B,1.3498394538,0.00557831,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-DNA,45L3EuUJKyqhkNDfocrd3yAZu8nzMPXiHtwhjCvidgua,B273T7o6o1Cn9uy4uByzKxpHGqqALAPo9JuZBp9ctZbK,5vBFyx35NGM1Z8r8iB8TLDpVA3mK7LhqqUu5E2iTbJU6UNxPxmMFTTwspqa2Zh6FUKizddQVH2vtEQELWz3rLXbS,617,5,0,true +2024-12-06 01:33:22.000 UTC,2024-12-06,2024-12-01,Sanji,solana,2.48840085109,Sell,0.010124917,SOL,So11111111111111111111111111111111111111112,2.5,USDT,Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB,0.0174201776,0.00007088,SOL,So11111111111111111111111111111111111111112,raydium,4,USDT-SOL,7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX,EYzmfW4iqDGNhgTiyA71ETMLnSRPJEKykYzDwNWBQFYv,5sY1pA9d1NY7byu4pK6FAtNGjASU51zv5guRb31HNws5pGVg88XEpMNbPULSCo3GbYhbzgRgKynyejhxfWNodBHg,895,5,0,true +2024-12-07 06:41:44.000 UTC,2024-12-07,2024-12-01,Sanji,solana,0.0774845692,Sell,0.00032884,SOL,So11111111111111111111111111111111111111112,6503.817475,Trump47,PfzhpjdDd2rHLRLWyTQBbqB6KBJfx8yVVGqSYkq5bqC,0.000541949,0.0000023,SOL,So11111111111111111111111111111111111111112,raydium,4,Trump47-SOL,2kcuRFMvJvqe82E7byJBCDMn4LT4zNFb2FpPhVbdqCw2,BLZ2UfxRoJ8arGKgAtArQ1SDFDttFA8c6v4qyPGpZLaq,4MNycd2wXRvzR8hikbS5Wsudn3tmf2vHjzxsuXSk5fvBzWW5oYFGLfv7pH1Pdo1eTL2kno7jwsDbVEFz5izKRboM,1480,5,0,true +2024-12-12 22:57:10.000 UTC,2024-12-12,2024-12-01,Sanji,solana,45.932176694949995,Sell,0.201342115,SOL,So11111111111111111111111111111111111111112,7151571.722822,JAILFORJAY,3KSkAdFbPHfGREVEo3DcGDBHEdZ8Ey3zGgFSajYVpump,0.1618422659,0.00070943,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-JAILFORJAY,Exj9V36qy1esrknFo4SAi8728BEGcrXPLwquDHfLtNqZ,8ChErCicUoNVmKbMuzVzoSoVn9s9Fkrsf8f2PoFKWrbZ,5un9ZXyeZfrYrEutX3dVG2dY76GWViTmVR4KVhfKBJQoqixsW2aZisRr31mEz86pfhoUoTWnVsqBqW5qrpyL8RPX,164,3,2,true +2024-12-12 03:19:52.000 UTC,2024-12-12,2024-12-01,Sanji,solana,67.28554651878,Sell,0.293643827,SOL,So11111111111111111111111111111111111111112,629457.273508496,CHILLSLUT,4F33vogWv87XcpGYL4pPXBfmXc5XBEKqPTVYrJrFpump,0.4643155476,0.00202634,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-CHILLSLUT,CYHPMpq6paZHLe24um42WPQMNRGNGTK4Q2LgDFWPZEdS,Ghcb5NXNE8KwvRYob3b8oGy6g5GF9z3Gd4rfrujCRAuL,TckxHyY7orvMD2Aidin1yWhpZM6L614TP8wV4zJTxN1nwgpSmS9AXyzrhG5i7vNp7DJvuurs1aQwPXyqwKEvHc1,757,5,0,true +2024-12-08 02:52:58.000 UTC,2024-12-08,2024-12-01,Sanji,solana,200.38093529355,Sell,0.831697735,SOL,So11111111111111111111111111111111111111112,1748801.699025,T51,4zGCj2Rq16sp3fFdzZHbVUdAqeS4p9buThjKKRQGpump,1.4026679577,0.00582189,SOL,So11111111111111111111111111111111111111112,raydium,4,T51-SOL,GAjizQ2pXjkT962BU9ge7iKkaJtVYvQyHvPfV4vVR9YN,4o3DSxj7rj6mJUNYYCy4vm3dKDwteZVR27K1XT8eSrqu,4BwNnddS7SJpi2oUGH4F9KWo4sQp7RoHERbJtn7eevAshAToZagzR4neQHc867ueKvFa2aU7PmYS3L3xJtEJnbyN,1722,5,0,true +2024-12-07 16:58:51.000 UTC,2024-12-07,2024-12-01,Sanji,solana,7.07179338996,Sell,0.029224702,SOL,So11111111111111111111111111111111111111112,3750224.749119,USA,69kdRLyP5DTRkpHraaSZAQbWmAwzF9guKjZfzMXzcbAs,0.0494800704,0.00020448,SOL,So11111111111111111111111111111111111111112,raydium,4,USA-SOL,HKprCtGbnh1j8xeQggzWhhVd3kwDUdphqPqDP8vMay8b,7wyuQVaYkPxu7oTp1juBXCpmjXM1JvjtBH2bDmWWjddp,xXHQ2v53E2fDymBmad8vQtQZCapEX3MFMr2k5vLgB3vjZV5sdKFtxnGaL8e7JrnYLLcA4cT5t2BbnYZGfhdaDqP,391,5,0,true +2024-12-01 04:48:17.000 UTC,2024-12-01,2024-12-01,Sanji,solana,1.5498037895799999,Sell,0.006555299,SOL,So11111111111111111111111111111111111111112,2707.23956,SNOOPY,CSh9t2fx2TAE25AiZ9oagdcuHomTQoCE1PGxaMjfpump,0.0112039438,0.00004739,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SNOOPY,6NZ8USQQCiy2dAe6Qg7GZGMRS1z86qq2iH8bokD271ht,BcGqkk3QVi4XmN4BN4deJSvGL1ss8AwiM3n1L7BouFr1,47fBahJ11QJTSkcn2qqdMTc69nQ53yZW5yqu48DzTiLckYu2hwMJATMmQsjhoAGVUDSsUphocrPsFmH7VgL6nEUb,987,5,0,true +2024-12-12 06:28:07.000 UTC,2024-12-12,2024-12-01,Sanji,solana,93.99705161856001,Sell,0.408540732,SOL,So11111111111111111111111111111111111111112,2598.06085,APPLE,H33XL6HHDReCVRgSApZpsXM7Hy7JGyLztRJaGxjapump,0.6579804832,0.00285979,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-APPLE,BEMi9yKdXLL9rNY43cU8CVxZZP4hmr7w7odwtxAMKAzD,vv7iSWi5CFuP9GCv1ufASHBDz6kFNDEWq5nhnpKaLUt,3xS9c2bGTWoTkXfFtRriP8DYTUTm29tqdkpEvCWLe6KJtMDdqvJjgmer3QWffWVYijwkp9ouDTBVVfvjKLmeRnZc,1708,5,0,true +2024-12-04 03:46:15.000 UTC,2024-12-04,2024-12-01,Sanji,solana,7.153499999999999,Buy,99989.752594,JIZZ,Ggx1nVeY23M16r2YqgeJfXMqA5WCGmTQN8RqhaXWPbTL,0.03,SOL,So11111111111111111111111111111111111111112,0.0500745,0.00021,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-JIZZ,EhY8JFCUyPuqJpdNiU9shKjToQb1b6qycmMwdx1o2LSv,2fBwpC4QGeExBWDfpGSqTNMC8xqWMu4Q8gSJYDYiSxta,3QUbFCvFCRDcarhnprUfwDpMFd5mJc7Mp9RXAyqRmmgJWydnQgaBe8i9VgyjKDp3JbL2JwUjqBQhN8qzgd65ugGa,1605,6,0,true +2024-12-12 14:40:20.000 UTC,2024-12-12,2024-12-01,Sanji,solana,4.125138145739999,Sell,0.017878638,SOL,So11111111111111111111111111111111111111112,234.904987,TRUST,EqeEBGHQhQy6SqeaJcnqAsNs3qaG19sdF89Xsarpump,0.02884125,0.000125,SOL,So11111111111111111111111111111111111111112,raydium,4,TRUST-SOL,9dkWXEmCvQGLazzbWZiSDExoPKiw7HkwPSM5bJW8qymL,BtZ1iVeH6h98fgi88pF6qj9oG41v42n3yndpSMDif4kh,5fx2StwS691CMAcJgk7jSPwuUVg1nuWtyKbdfrTNVg62r3uqzejo8yH3o4vYGUGht2yG84HXTJEEFSFtMkcgcqk7,3037,5,0,true +2024-12-12 00:13:26.000 UTC,2024-12-12,2024-12-01,Sanji,solana,3.06566549352,Sell,0.013495622,SOL,So11111111111111111111111111111111111111112,476869.372056,AWWTIC,BPcCs1fer87KzqgkHHCvR36SkfDqaEcLGxt62fkkpump,0.0214620768,0.00009448,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-AWWTIC,4icnNdfDN3FyzTpXBBJWZ5BRHnjvLRAkgK5QhhxDHSD7,8UWDczTGjzjnwmQ3Ah6jcN5qPxCT9oWB3BKhfWyW9G6R,59nJmeny6UzHEeRdUMG1UhVY1xE74yJrR7o9rLauHfPUAsg2yR38oK3mM8sDGtYV8uxXAFmFtmTqH7zmW4FQtLuj,1926,5,0,true +2024-12-12 20:06:07.000 UTC,2024-12-12,2024-12-01,Sanji,solana,6.8361,Buy,37511.994306,CHAINSAW,7nFvyQr2mwHLjBBECj3MsUxeAbP2D89p7Tx6bQtBpump,0.03,SOL,So11111111111111111111111111111111111111112,0.047852700000000005,0.00021,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-CHAINSAW,Eg4hFsUc2MwiBumykUe5dnQws37M3P3WzdGFKpQuqp5t,AQLntiBeqNvynXjrWJv4MSmMFURSfrSbasjUbqwHyWN1,uhCyivWoQUksTryEegnTYxRjrXAp3aeBWRyc8q8Kr99FPj3m1rGZm8tq67fRsbqBSkUs6y4NL7jFGhMEoG9Ke5v,2138,6,0,true +2024-12-13 20:05:17.000 UTC,2024-12-13,2024-12-01,Sanji,solana,0.67938346075,Sell,0.003043151,SOL,So11111111111111111111111111111111111111112,2200.998928,EVOLVE,HQ7NoKrgxcep1hSnNKGbWRtpMf59As5eVKeuwyCzpump,0.0043690025,0.00001957,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-EVOLVE,6J3DXzGB9Ndw795pAfH65HQSDo4MwgRbFDpSF27L3g4S,9zxuSu9cp5euiHaB9NAZ1Y6PhtASWmpetDhvrAUhZBZm,44UWzYjiCcsG6RS81CdCbzQjFaih8ppkkxedMUoZJ2qroSn8Tqov1EXzQfiPvh8cPABK3sCXCdmBppoHSXMFxTFx,1962,5,0,true +2024-12-12 20:47:31.000 UTC,2024-12-12,2024-12-01,Sanji,solana,0.01325559392,Sell,0.000057814,SOL,So11111111111111111111111111111111111111112,0.00000341,WETH,7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs,0.0000940048,4.1e-7,SOL,So11111111111111111111111111111111111111112,raydium,4,WETH-SOL,4yrHms7ekgTBgJg77zJ33TsWrraqHsCXDtuSZqUsuGHb,6VvTvxNoZzHVgivqeFrzBcKK8N9ckMGbMTxcNgbB8MVo,2YjFHGk3YnWdLukUzUmZBZhtQbh7rhoVtSxDDEKtuCVqun85E2DG7tE13D8S9XuiEs58PbfHcBF7BJ61DKWY8wyP,1634,5,0,true +2024-12-12 13:26:56.000 UTC,2024-12-12,2024-12-01,Sanji,solana,0.0017850892199999999,Sell,0.000007698,SOL,So11111111111111111111111111111111111111112,4.5e-7,WETH,7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs,0.000013681509999999998,5.9e-8,SOL,So11111111111111111111111111111111111111112,raydium,4,WETH-SOL,4yrHms7ekgTBgJg77zJ33TsWrraqHsCXDtuSZqUsuGHb,6VvTvxNoZzHVgivqeFrzBcKK8N9ckMGbMTxcNgbB8MVo,FQBE9S8LZTiSvtMCU6qYwtRbvDCG2syeLGXUMq2whe4ALcYHNixAYxSsNY67F3QLACHYjhM1HojoeU7nPvko9J8,1019,5,0,true +2024-12-01 00:19:25.000 UTC,2024-12-01,2024-12-01,Sanji,solana,11.9225,Buy,345972.31649,GRINCHWIF,BoQPkPXdNqRuwyPpkC47Ac9mCk2WwhbgbDG5dt7spump,0.05,SOL,So11111111111111111111111111111111111111112,0.08345749999999999,0.00035,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-GRINCHWIF,ALkGqJ7inoN4n2wW6exur43YQRSHZ5dP3DpQ879DwM85,77PPF9tCqn3PsrYs7WhgKEpy76b3Uzh1i4B93BmoSq2G,4caUnR34GpNUDzeYWDWJZQEP7B6rycCLAoL6sDnYuzDF8ti7wXqsxDqoYuocumX4B7Nmzup8RyZxschkB9ZAQ2tu,1180,6,0,true From 39d698d8fcfad8121a0fe5b57196bbfe23608240 Mon Sep 17 00:00:00 2001 From: clizzard <145153355+clizzard7@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:58:01 +0100 Subject: [PATCH 30/32] add nova (#7307) * add nova * fixed seed * rename schema --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> --- .../_sector/dex/bot_trades/solana/_schema.yml | 22 +++ .../platforms/nova_solana_bot_trades.sql | 152 ++++++++++++++++++ .../seeds/nova/nova_solana_trades_seed.csv | 21 +++ 3 files changed, 195 insertions(+) create mode 100644 dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/nova_solana_bot_trades.sql create mode 100644 dbt_subprojects/solana/seeds/nova/nova_solana_trades_seed.csv diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml index 413d474f8a0..fb74d1ec172 100644 --- a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/_schema.yml @@ -734,6 +734,28 @@ models: seed_file: ref('prophetbots_solana_trades_seed') blockchain: solana + - name: nova_solana_bot_trades + meta: + blockchain: solana + sector: dex + project: nova + contributors: whale_hunter + config: + tags: ["solana", "dex", "nova", "trades"] + description: > + Nova trades on Solana + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_id + - tx_index + - outer_instruction_index + - inner_instruction_index + - check_bot_trades_seed: + seed_file: ref('nova_solana_trades_seed') + blockchain: solana + - name: sanji_solana_bot_trades meta: blockchain: solana diff --git a/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/nova_solana_bot_trades.sql b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/nova_solana_bot_trades.sql new file mode 100644 index 00000000000..2508b0dfedc --- /dev/null +++ b/dbt_subprojects/solana/models/_sector/dex/bot_trades/solana/platforms/nova_solana_bot_trades.sql @@ -0,0 +1,152 @@ +{{ config( + alias = 'bot_trades', + schema = 'nova_solana', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index'] + ) +}} + +{% set project_start_date = '2024-11-30' %} +{% set fee_receiver_1 = 'noVaE91mUL5jTb8e9Vf6dqJdNPzJpEQ3uAdnQ8h4nVz' %} +{% set wsol_token = 'So11111111111111111111111111111111111111112' %} + +WITH + allFeePayments AS ( + SELECT + tx_id, + 'SOL' AS feeTokenType, + balance_change / 1e9 AS fee_token_amount, + '{{wsol_token}}' AS fee_token_mint_address + FROM + {{ source('solana','account_activity') }} + WHERE + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + AND tx_success + AND balance_change > 0 + AND ( + address = '{{fee_receiver_1}}' + ) + ), + botTrades AS ( + SELECT + trades.block_time, + CAST(date_trunc('day', trades.block_time) AS date) AS block_date, + CAST(date_trunc('month', trades.block_time) AS date) AS block_month, + 'solana' AS blockchain, + amount_usd, + IF( + token_sold_mint_address = '{{wsol_token}}', + 'Buy', + 'Sell' + ) AS type, + token_bought_amount, + token_bought_symbol, + token_bought_mint_address AS token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_mint_address AS token_sold_address, + fee_token_amount * price AS fee_usd, + fee_token_amount, + IF(feeTokenType = 'SOL', 'SOL', symbol) AS fee_token_symbol, + fee_token_mint_address AS fee_token_address, + project, + version, + token_pair, + project_program_id AS project_contract_address, + trader_id AS user, + trades.tx_id, + tx_index, + outer_instruction_index, + inner_instruction_index + FROM + {{ ref('dex_solana_trades') }} AS trades + JOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_id + LEFT JOIN {{ source('prices', 'usd') }} AS feeTokenPrices ON ( + feeTokenPrices.blockchain = 'solana' + AND fee_token_mint_address = toBase58 (feeTokenPrices.contract_address) + AND date_trunc('minute', block_time) = minute + {% if is_incremental() %} + AND {{ incremental_predicate('minute') }} + {% else %} + AND minute >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + JOIN {{ source('solana','transactions') }} AS transactions ON ( + trades.tx_id = id + {% if is_incremental() %} + AND {{ incremental_predicate('transactions.block_time') }} + {% else %} + AND transactions.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ) + WHERE + trades.trader_id != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + AND transactions.signer != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet + {% if is_incremental() %} + AND {{ incremental_predicate('trades.block_time') }} + {% else %} + AND trades.block_time >= TIMESTAMP '{{project_start_date}}' + {% endif %} + ), + highestInnerInstructionIndexForEachTrade AS ( + SELECT + tx_id, + outer_instruction_index, + MAX(inner_instruction_index) AS highestInnerInstructionIndex + FROM + botTrades + GROUP BY + tx_id, + outer_instruction_index + ) +SELECT + block_time, + block_date, + block_month, + 'Nova' as bot, + blockchain, + amount_usd, + type, + token_bought_amount, + token_bought_symbol, + token_bought_address, + token_sold_amount, + token_sold_symbol, + token_sold_address, + fee_usd, + fee_token_amount, + fee_token_symbol, + fee_token_address, + project, + version, + token_pair, + project_contract_address, + user, + botTrades.tx_id, + tx_index, + botTrades.outer_instruction_index, + COALESCE(inner_instruction_index, 0) AS inner_instruction_index, + IF( + inner_instruction_index = highestInnerInstructionIndex, + true, + false + ) AS is_last_trade_in_transaction +FROM + botTrades + JOIN highestInnerInstructionIndexForEachTrade ON ( + botTrades.tx_id = highestInnerInstructionIndexForEachTrade.tx_id + AND botTrades.outer_instruction_index = highestInnerInstructionIndexForEachTrade.outer_instruction_index + ) +ORDER BY + block_time DESC, + tx_index DESC, + outer_instruction_index DESC, + inner_instruction_index DESC diff --git a/dbt_subprojects/solana/seeds/nova/nova_solana_trades_seed.csv b/dbt_subprojects/solana/seeds/nova/nova_solana_trades_seed.csv new file mode 100644 index 00000000000..e71fe551768 --- /dev/null +++ b/dbt_subprojects/solana/seeds/nova/nova_solana_trades_seed.csv @@ -0,0 +1,21 @@ +block_time,block_date,block_month,bot,blockchain,amount_usd,type,token_bought_amount,token_bought_symbol,token_bought_address,token_sold_amount,token_sold_symbol,token_sold_address,fee_usd,fee_token_amount,fee_token_symbol,fee_token_address,project,version,token_pair,project_contract_address,user,tx_id,tx_index,outer_instruction_index,inner_instruction_index,is_last_trade_in_transaction +2024-12-06 10:52:09.000 UTC,2024-12-06,2024-12-01,Nova,solana,2.336895,Buy,29376.95995,Queef,6sBcBA44i4g1m6UBMfkyn4rQKv1wag7UqB5yng7Cpump,0.0099,SOL,So11111111111111111111111111111111111111112,0.023605,0.0001,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Queef,CCCSXX9vERWwdpT7tGKWjUiYJjzhYd4wJqMeFo2j1ZB5,6UmQuA1koenTdJ6WRtraYneA7WhJC9YopVY8deUhfhR4,5tZLEggJ183v2X1fvJm7VhrAzJ7LBMVEKR3cT9YFoHyFFzuamyMgwsWTQ1M2FoKgPDdkavNoXVqooNVhaQx2542N,832,6,1,true +2024-12-04 19:50:20.000 UTC,2024-12-04,2024-12-01,Nova,solana,126.45952852578002,Sell,0.544005543,SOL,So11111111111111111111111111111111111111112,2290980.376444,Int,3rq9pxbn9b3pBmQZEwyDieh5QgwF77wVSZprwYhqpump,1.25194912884,0.005385654,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Int,BYDqrvBUWN9bEHHS5gRYpvxmht6GssAa2nFRA7cTcuCu,3daw5AUQXuQE8BwWevn9CSE5uKby28yu2oHJasB3dQLr,DxaqUyVNMhGXnb1SPrhb59F2bDKhuiZeJZseegjA8jcoU2eEKgZS3ZdWeoZjqsXAWsLar2WyFuDvVDfUSm4vnm4,1626,4,3,true +2024-12-06 12:54:28.000 UTC,2024-12-06,2024-12-01,Nova,solana,11.511921556419999,Buy,364304.938888,entry,3uZPvXaHH3ky2Vv9w1tkwEDtKYWqDCJ12WuE7FEppump,0.049537078,SOL,So11111111111111111111111111111111111111112,0.11619499999999999,0.0005,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-entry,DzEyLM8zFnqq3XNSVbyNxHNYAWpm8FmP3VnAJ51Nj8ye,4EGs99ECwUkwE4nxxapRyC4hdjX8aP9CdWwoJTV4KUX1,5r4wH4jMEofRzP9Sai7YoBATFhVxHhixoEfQUfoPhBninZbyMaNMj6jVUujrrG9NT2e2i62VzAa5vXKTz5q7WbNT,828,4,5,true +2024-12-11 08:26:32.000 UTC,2024-12-11,2024-12-01,Nova,solana,240.96468838129,Sell,1.091671673,SOL,So11111111111111111111111111111111111111112,17017539.00197,Fuji,2xV8eMGgZtLuiGE8gkpQzHLwoJt1PEZ1y5k7hU15pump,2.38555029077,0.010807549,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Fuji,AoJzpdNa5msoNtAzPjBvDXGBjDLnMT7W3uL6ziUztrvB,D7RRsBqadacKN2iHwRPhAwmxkAegekmU6e5EJTXksEPH,2Qei2PVABjF9kwLkKMWqqPviCXFn5WxaQQXKdPkwuuQXM6bSbtdzuQ5zEqEjGVxu9F1Z1yQx5b9U2SGnheeybsyZ,1614,4,3,true +2024-12-11 09:06:42.000 UTC,2024-12-11,2024-12-01,Nova,solana,3.4589988938399996,Sell,0.015617658,SOL,So11111111111111111111111111111111111111112,12162.93127,o1,2wPCNPVRat4ZVFLK2cWFf7FxNKQJP1SUC9rv3FRXpump,0.03458986048,0.000156176,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-o1,9ji9mLEJXf8BYVs4fMFoTLHhxpyamGZYJRUETPczx1Dh,EkN1h43qTCbGhmCmL9qM6NCsXLXyinFjuuVQ1n6bmPsT,3c5GnTmKH5oWh7wdZd3j6mpKMAe213SvMstxH872pCgYm4Z7utiFjrpzBRMrdpbA42yGUpTw3AZLZY2LWTSb6yRt,567,4,1,true +2024-12-06 03:34:54.000 UTC,2024-12-06,2024-12-01,Nova,solana,239.75219680254,Buy,2766765.95187,MPIGGY,DEj74N1Zfs2qWJ4QdsUj2dBUGXTJvgSM2rGnvPnZJMzQ,0.999217291,SOL,So11111111111111111111111111111111111111112,2.3994,0.01,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-MPIGGY,,EF3Xy3e9zEhsucRjYixgBkPhohdJqwQ5PnbqskoRS5tH,4aR72MtDtnwGi99va776UEM4d4Y1ERLq4XsURXjTXM2PSEfLdmZN3jDkH7vwnGRMgyMmWUixwtn19mf1rTv8HMhS,63,4,5,true +2024-12-08 03:16:53.000 UTC,2024-12-08,2024-12-01,Nova,solana,238.54049999999998,Buy,177792.733025,BRAH,EjNADFFKpKJHqEPp1GLzx2ECjFL2d65J3pcGhbP4pump,0.99,SOL,So11111111111111111111111111111111111111112,2.4095,0.01,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-BRAH,4xSk39qGUvkf3H7JusDcVRfwV8enoGnswS8a8G91e6bT,4BxjftWJs2pWeEjMNiJeiB2wXKSapnxfZMWnDbj9ZmdX,5mkESD7H2Z1Djg1YnMJFBD2DH7eFRhGtWNsZsxo1neNFhDnVn3DpEMf4JmaRs9TYonZLZQRpDMdFFQr7g9EjDyP8,171,7,1,true +2024-12-09 02:52:56.000 UTC,2024-12-09,2024-12-01,Nova,solana,2.3050340978399997,Sell,0.009967284,SOL,So11111111111111111111111111111111111111112,3882.064707008,SDOGE,2ARPkfifeN9cQyPAmEcNie5KUHApMykCQHb7R1ib5txe,0.02305014672,0.000099672,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SDOGE,Hj1bx6VEQU7bRkaZLJpoNWgpofg3nLExKrH53e8zYnqd,BcSgJcT2GdkxQcibP8uvj8gGUj8yQREp57AXZvZXDB43,F5dwis6oXVHFWCGVjznZsoMDjhSbbnjSUMPopdjx1G2bucZ5VDAmDZ93BKTCtoyLFhTWgXfRY5w3Af2YnwECiAj,602,4,1,true +2024-12-07 14:06:49.000 UTC,2024-12-07,2024-12-01,Nova,solana,124.16807477799999,Sell,0.5194013,SOL,So11111111111111111111111111111111111111112,87590.427802,SOLDIER,GGUxJxZqUDfNbnzQqdCnrEzUX7LuCA9usdAkkSfApump,1.24168074778,0.005194013,SOL,So11111111111111111111111111111111111111112,raydium,4,SOLDIER-SOL,3wReKYqb76AqStpVTZHGefrqAMH1yTv8nk4PqZyFwyeW,EWhcbXDKx2gTEXxiYuEnJ7YtfRgna4XMwdW7ELzEiQNs,21NuyTNeNhXjVPNFkEN7RVFDjFUg2uESqzVxQeS9BHGoq1dQuTFfxEvDrXEDifswMxwt5FY5SPNKBpg4p8om6DX8,801,4,1,true +2024-12-11 17:09:29.000 UTC,2024-12-11,2024-12-01,Nova,solana,166.62935509779,Sell,0.724822111,SOL,So11111111111111111111111111111111111111112,163580.068884,FKT,EHziSfC9bfpCGWpiYHSkYhBQTXsKpBJTsn5z5EyKpump,1.66629352569,0.007248221,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-FKT,55Vyv9QAKxSVX4nmufZQCKXk5WA1VnEgGcvtyav8R5ey,CtZtEjTVVbPnoHwfyxMSfei9uTLe7ts7yVKKKDkejeno,GCTUUUNMXRJ7xEU2rxFciEQGAadqUS8owS4pH6SD84KmESPFxEDBiTPurBiqsstCEpuKP6utxrnvRFNWovEH17x,1214,4,1,true +2024-12-11 04:15:16.000 UTC,2024-12-11,2024-12-01,Nova,solana,65.15147218416,Sell,0.297876153,SOL,So11111111111111111111111111111111111111112,653440.556033,BERNZY,DvgkpHBUfH5UE9ed4A7PfaBdE2yKpQ9pscyFrQwEpump,0.65151460592,0.002978761,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-BERNZY,3NBi4gcQZBj4mvG3GVhmoPaY1i4Pg4MvsgdR7g5AKNnV,6Eo8a9FxjpFNL8R6HZ2Rp6v4ZUustoLaeVehahjY817j,2Bwom76L4yFpEuEWAfdaG8THkUhQQck3b4i7arHAHFTDHhck2LEgZnPoSTHN9XPQs94oDPpFiFs1jgYr3ub8p4MH,1197,4,1,true +2024-12-11 06:57:55.000 UTC,2024-12-11,2024-12-01,Nova,solana,186.61399539676,Sell,0.847551982,SOL,So11111111111111111111111111111111111111112,161919.644767,BrettAI,CHLiroKnCmzoAJ37236F2Y5nGmpEkC1cQoa8L1AGpump,1.8661397734200003,0.008475519,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-BrettAI,4YorehZjDUSVcXfs222Y1DrbBVvpRMq17ZFNpgXd45Bb,8coN8Dq9R71tFoKjXVo1hjnH1gFRkRgvrjzcg4vkwx3E,54H2coEwVA5VWEhxa1o6DXY7ccZV9J4G1kxtLKLZ5wLnne9MpbPBZWoT8KTozUX1pPZATD8VnqDwdkEajs3SxTih,241,4,1,true +2024-12-11 13:39:47.000 UTC,2024-12-11,2024-12-01,Nova,solana,67.34178,Buy,276547.749475,KOVU,Acud16jqA9j1Hc83JrHYeiN2BpK8LYYQ1h6FGnYrpump,0.297,SOL,So11111111111111111111111111111111111111112,0.68022,0.003,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-KOVU,EFp41LWtiEzaVFiYhMema8ETHwJfx3fvdMJ2EAbUq37E,92v3iTUKvr4NZ9MSeQitRdu7BkifeCMXVJiuggtkE8uu,4FknfwQaCiHskhDbUTzramrFvSZjgTHR8RfYMeYg6F9JkDN5DRsxygpJpzQMbKHHWj9YEoKXwTiCgXnDsQ6vcguY,1283,7,1,true +2024-12-11 17:54:24.000 UTC,2024-12-11,2024-12-01,Nova,solana,40.909980354720005,Sell,0.178771108,SOL,So11111111111111111111111111111111111111112,1664280.240719,LilysBed,HKrM8f2DCGqVa2mgPwJb5oAevbqmursDEMnA4hszpump,0.40500858372,0.001769833,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-LilysBed,GMBSFRKSzvg61egswdhLPCS2GVcDPkregSSzTLzBRMpk,GnEuZhJp51vf23kwYNktiHmTjbHVNNGYNorxwi9uY5Q2,4v78BzGfCW7BPE5aSM1ir6B3rYBhiPWkFbvBj3g2ehVWN24Uqfa2DhnbZqFgd1KVE8jMhpX9gndAseHTLjVy1BRt,655,4,3,true +2024-12-12 05:09:56.000 UTC,2024-12-12,2024-12-01,Nova,solana,45.46674,Buy,318421.086978,Frog,8si8aCqGyzW2faCEHMbwKxLGMzbPQdjccSWhrYUVpump,0.198,SOL,So11111111111111111111111111111111111111112,0.45926,0.002,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Frog,21Bnj82WEr4ZQzmSHmARYZeU6Mgm3ipFTVU7JhD8XbDz,DbczwqpdHtALaWHpDWCYRzuTaowbPdRX6vgg6oBMJLFe,4JwzNgbWwDmXV7F717t4xZ7MGyoEXFhtW1HYgWKi28oqmjbHLTDvfxWgAYNJAsUkJbBBr8Ps5qe2rs5iK23ZFBNs,1755,7,1,true +2024-12-08 22:05:34.000 UTC,2024-12-08,2024-12-01,Nova,solana,117.54818121,Buy,4480224.629267,FART,2gcS7doQQb3jisCaPeAtcA6xFEXkY9s12j1157xbpump,0.49914302,SOL,So11111111111111111111111111111111111111112,1.1775,0.005,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-FART,Esc6woR2gGtBzeswbWWuZasGF2RNb8yESG2jFEFdBaPv,2vz8yVLLS6QFboK9xtpKv24tu7GUo7SHgXZDiBzSPby8,3f9QmZUeuHToi6u1gmudS92DvmjJk1LMY1oXJvuuxSHsNA9t3cUbqNvh2uvWP8ZSk7ER9QBzY5NZ1TiyVmDg31Ws,1088,4,5,true +2024-12-09 00:22:55.000 UTC,2024-12-09,2024-12-01,Nova,solana,11.660715,Buy,104953.750318,Aaliyah,BkAUZGUSfUtxPgRJJ2JDDk1XdM72zEsf4ozsmB1Spump,0.0495,SOL,So11111111111111111111111111111111111111112,0.117785,0.0005,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Aaliyah,CzW4ZoCyA5oDkxL8qhH9n9rKfaPZrVjJp6yuDX6LdHkC,DbczwqpdHtALaWHpDWCYRzuTaowbPdRX6vgg6oBMJLFe,5UxvyhvrKKezVbpVbQFLN2eeAB4uqrBGzaUbWLzcgdfZzpxAchGegviV1159VWyBPVTaVpCKbCVRr3zHXG6gHvkB,1853,7,1,true +2024-12-05 23:26:17.000 UTC,2024-12-05,2024-12-01,Nova,solana,237.2832,Buy,413016.040553,TIME,8oLsaCFngYG6vaRDCbFZTqWuBiz3swAL3RH4unXZpump,0.99,SOL,So11111111111111111111111111111111111111112,2.3968000000000003,0.01,SOL,So11111111111111111111111111111111111111112,raydium,4,TIME-SOL,G5pWpEtvAQCQAxEnyHDWrg8W1JFSp5hwPqYjtCAyrgdM,5URGB13Skm7oKyJgCgMpPU755veJajtHHuovQKMHrrrY,5T8GbHUH7C8JxGqCvM4miEzPYfT2SGhcC9iMsuKWxso4BwZZxLWxLGikw99ckFhKrsz9nwwsp7Csmpmdj9ijuGVv,962,7,1,true +2024-12-04 03:25:55.000 UTC,2024-12-04,2024-12-01,Nova,solana,118.7494441513,Buy,2884988.076315,Jarritos,chVWsF9er1J2umikgjrCxcMojdVn3yeszEuTjiEpump,0.498319111,SOL,So11111111111111111111111111111111111111112,1.1915,0.005,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-Jarritos,,DcpvApMJBJY7UnxxNpiFo8s6V97jBg1usvPcAcroAKQR,3UG11MTv2UabeSPkn9abzj6QM4RvKeyHqQLKBDLQ1MNJGBHjzyodBbpHYz6CDNGTQMNEBJwh3urx1ztFU6Ki68SH,2241,4,5,true +2024-12-11 23:26:18.000 UTC,2024-12-11,2024-12-01,Nova,solana,131.57564682496,Sell,0.578024192,SOL,So11111111111111111111111111111111111111112,14727345.799435,XENA,3Yxasmk23oCReSebfhkjMHvEQyVPnSr4fvBMVMKgpump,1.30259878957,0.005722439,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,XENA-SOL,6oQreXqmsB6twE8f9phvMoDdequxjVigF2sHAjMbSXmM,3ENRG3FZp3nwcGDv7hMJ9VPTEAo1qVEdPgrkL9NoknNP,31PX7xburMDvWiieFyUhnQ7cf9LTLxk5MeKrudhVii3jVD9NQTYxZzbciiA6gWHZLhwNjcHP82Q39Pfh1opeR3bZ,1314,4,3,true From d2be350cb2f37c79f9466c70098da8d78217013d Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Mon, 16 Dec 2024 22:24:49 +0100 Subject: [PATCH 31/32] [CoW Protocol] Base changes dependent on #7295 (#7319) * [CoW Protocol] Base changes dependent on #7295 * add extra join condition for performance * select evt_block_number on gnosis view * more block numbers * group by --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../cow_protocol_arbitrum_batches.sql | 1 + .../base/cow_protocol_base_batches.sql | 99 +++++++++++++++++++ .../base/cow_protocol_base_schema.yml | 25 +++++ .../base/cow_protocol_base_solvers.sql | 64 ++++++++++++ .../cow_protocol/cow_protocol_batches.sql | 22 +++++ .../cow_protocol_ethereum_batches.sql | 1 + .../gnosis/cow_protocol_gnosis_batches.sql | 5 +- 7 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_batches.sql create mode 100644 dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_schema.yml create mode 100644 dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql index 46c51e364c8..5b69f8d0065 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql @@ -89,6 +89,7 @@ combined_batch_info as ( on b.evt_tx_hash = t.tx_hash inner join {{ source('arbitrum', 'transactions') }} tx on evt_tx_hash = hash + and evt_block_number = block_number {% if is_incremental() %} AND {{ incremental_predicate('block_time') }} {% endif %} diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_batches.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_batches.sql new file mode 100644 index 00000000000..89c3a314de9 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_batches.sql @@ -0,0 +1,99 @@ +{{ config( + schema = 'cow_protocol_base', + alias = 'batches', + materialized='incremental', + partition_by = ['block_date'], + unique_key = ['tx_hash'], + on_schema_change='sync_all_columns', + file_format ='delta', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "cow_protocol", + contributors = \'["felix"]\') }}' + ) +}} + +WITH +batch_counts as ( + select try_cast(date_trunc('day', s.evt_block_time) as date) as block_date, + s.evt_block_number, + s.evt_block_time, + s.evt_tx_hash, + solver, + name, + sum( + case + when selector != 0x2e1a7d4d -- unwrap + and selector != 0x095ea7b3 -- approval + then 1 + else 0 + end) as dex_swaps, + sum(case when selector = 0x2e1a7d4d then 1 else 0 end) as unwraps, + sum(case when selector = 0x095ea7b3 then 1 else 0 end) as token_approvals + from {{ source('gnosis_protocol_v2_base', 'GPv2Settlement_evt_Settlement') }} s + left outer join {{ source('gnosis_protocol_v2_base', 'GPv2Settlement_evt_Interaction') }} i + on i.evt_tx_hash = s.evt_tx_hash + {% if is_incremental() %} + AND {{ incremental_predicate('i.evt_block_time') }} + {% endif %} + join {{ ref('cow_protocol_base_solvers') }} + on solver = address + {% if is_incremental() %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + group by s.evt_block_number, s.evt_block_time, s.evt_tx_hash, solver, name +), + +batch_values as ( + select + tx_hash, + count(*) as num_trades, + sum(usd_value) as batch_value, + sum(fee_usd) as fee_value, + price as eth_price + from {{ source('cow_protocol_base', 'trades') }} + left outer join {{ source('prices', 'usd') }} as p + on p.contract_address = 0x4200000000000000000000000000000000000006 + {% if is_incremental() %} + and {{ incremental_predicate('minute') }} + {% endif %} + and p.minute = date_trunc('minute', block_time) + and blockchain = 'base' + {% if is_incremental() %} + WHERE {{ incremental_predicate('block_time') }} + {% endif %} + group by tx_hash, price +), + +combined_batch_info as ( + select + b.block_date, + evt_block_number as block_number, + evt_block_time as block_time, + num_trades, + dex_swaps, + batch_value, + solver as solver_address, + evt_tx_hash as tx_hash, + gas_price, + gas_used, + ((gas_price / pow(10, 9)) * gas_used * eth_price) / pow(10, 9) as tx_cost_usd, + fee_value, + 2 * bytearray_length(data) / 1024 as call_data_size, + unwraps, + token_approvals + from batch_counts b + join batch_values t + on b.evt_tx_hash = t.tx_hash + inner join {{ source('base', 'transactions') }} tx + on evt_tx_hash = hash + and evt_block_number = block_number + {% if is_incremental() %} + AND {{ incremental_predicate('block_time') }} + {% endif %} + where num_trades > 0 --! Exclude Withdraw Batches +) + +select * from combined_batch_info diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_schema.yml new file mode 100644 index 00000000000..ecc9d21b4f1 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: cow_protocol_base_solvers + meta: + blockchain: base + project: cow_protocol + contributors: felix + config: + tags: ["base", "cow_protocol", "solver"] + description: > + CoW Protocol solvers list on Base Chain + + - name: cow_protocol_base_batches + meta: + blockchain: base + project: cow_protocol + contributors: felix + config: + tags: ["base", "cow_protocol", "trades", "dex", "aggregator", "auction"] + description: > + CoW Protocol enriched batches table on Base Chain + data_tests: + - unique: + column_name: tx_hash diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql new file mode 100644 index 00000000000..70375160bd4 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql @@ -0,0 +1,64 @@ +{{ config( + schema = 'cow_protocol_base', + alias='solvers', + post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "cow_protocol", + contributors = \'["felix"]\') }}' +)}} + +WITH +-- Aggregate the solver added and removed events into a single table +-- with true/false for adds/removes respectively +solver_activation_events as ( + select solver, evt_block_number, evt_index, True as activated + from {{ source('gnosis_protocol_v2_base', 'GPv2AllowListAuthentication_evt_SolverAdded') }} + union + select solver, evt_block_number, evt_index, False as activated + from {{ source('gnosis_protocol_v2_base', 'GPv2AllowListAuthentication_evt_SolverRemoved') }} +), +-- Sorting by (evt_block_number, evt_index) allows us to pick the most recent activation status of each unique solver +ranked_solver_events as ( + select + rank() over (partition by solver order by evt_block_number desc, evt_index desc) as rk, + solver, + evt_block_number, + evt_index, + activated as active + from solver_activation_events +), +registered_solvers as ( + select solver, active + from ranked_solver_events + where rk = 1 +), +-- Manually inserting environment and name for each "known" solver +known_solver_metadata (address, environment, name) as ( + select * + from ( + VALUES + (0x8d98057b8c3d6c7cB02f1C1BE7E37D416F2D3e96, 'barn', 'Baseline'), + (0x351DfD19DfA0e3BfD3E7D9B22658C09e66Fd14AD, 'barn', 'Seasolver'), + (0xcE55eD17ddD7ED6E7eC396eaC772959A6D7252EA, 'barn', 'Naive'), + (0x8982b03D56de1F6f173d04A940B20A69F6A59239, 'barn', 'Gnosis_1inch'), + (0x5951400dE8fA58DA26Ab9402D2603ec0bD788273, 'barn', 'Gnosis_ParaSwap'), + (0x147d05987f3008A6C9Ec3E93A4ead430907ac3E1, 'barn', 'Gnosis_0x'), + (0x9451D27C993f7a61096BFC33e0241644a7566F66, 'barn', 'Gnosis_BalancerSOR'), + (0x0AC9287C83C2386A6a0bb27F847Ce59a0034183C, 'barn', 'Laita'), + (0x69d7F96dFD091652f317D0734A5F2B492ACcbE07, 'prod', 'Baseline'), + (0x4cb862E4821fea2dabBD1f0A69c17d52da2A58f6, 'prod', 'Seasolver'), + (0xF401ceF222F1CA2fE84a8C7BFC75A636A4542A74, 'prod', 'Naive'), + (0x8F7f754300B1ccfa37eA25fD48FB059af0F19e12, 'prod', 'Gnosis_1inch'), + (0xe321609c56aD89711EfB69c248ebe94922902F81, 'prod', 'Gnosis_ParaSwap'), + (0xbBcCE072fb1Bd2C096667E257322f47693D3dc96, 'prod', 'Gnosis_0x'), + (0x983aC485620E265730e367B2C7BCBf6Eb9d62A21, 'prod', 'Gnosis_BalancerSOR'), + (0x1A422923290fd16C2ED00ED16B4203cF4bb35d82, 'prod', 'Laita') + ) as _ +) +-- Combining the metadata with current activation status for final table +select solver as address, + case when environment is not null then environment else 'new' end as environment, + case when name is not null then name else 'Uncatalogued' end as name, + active +from registered_solvers +left outer join known_solver_metadata on solver = address diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/cow_protocol_batches.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/cow_protocol_batches.sql index 5a13b752fa1..a45d21db499 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/cow_protocol_batches.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/cow_protocol_batches.sql @@ -73,4 +73,26 @@ FROM unwraps, token_approvals FROM {{ ref('cow_protocol_arbitrum_batches') }} + + UNION ALL + + SELECT + 'base' AS blockchain, + 'cow_protocol' AS project, + '1' AS version, + block_date, + block_time, + num_trades, + dex_swaps, + batch_value, + solver_address, + tx_hash, + gas_price, + gas_used, + tx_cost_usd, + fee_value, + call_data_size, + unwraps, + token_approvals + FROM {{ ref('cow_protocol_base_batches') }} ) diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql index 27849f7bd64..5a37703d2ef 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_batches.sql @@ -90,6 +90,7 @@ combined_batch_info as ( on b.evt_tx_hash = t.tx_hash inner join {{ source('ethereum', 'transactions') }} tx on evt_tx_hash = hash + and evt_block_number = block_number {% if is_incremental() %} AND {{ incremental_predicate('block_time') }} {% endif %} diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql index dd63b3cafad..354ef3d9446 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_batches.sql @@ -19,6 +19,7 @@ WITH -- Find the PoC Query here: https://dune.com/queries/1722419 batch_counts as ( select try_cast(date_trunc('day', s.evt_block_time) as date) as block_date, + s.evt_block_number, s.evt_block_time, s.evt_tx_hash, solver, @@ -43,7 +44,7 @@ batch_counts as ( {% if is_incremental() %} WHERE {{ incremental_predicate('s.evt_block_time') }} {% endif %} - group by s.evt_tx_hash, solver, s.evt_block_time, name + group by s.evt_block_number, s.evt_tx_hash, solver, s.evt_block_time, name ), batch_values as ( @@ -70,6 +71,7 @@ batch_values as ( combined_batch_info as ( select b.block_date, + evt_block_number as block_number, evt_block_time as block_time, num_trades, dex_swaps, @@ -88,6 +90,7 @@ combined_batch_info as ( on b.evt_tx_hash = t.tx_hash inner join {{ source('gnosis', 'transactions') }} tx on evt_tx_hash = hash + and evt_block_number = block_number {% if is_incremental() %} AND {{ incremental_predicate('tx.block_time') }} {% endif %} From cccc1a238a2cfba777db9c11f7664da14bc57440 Mon Sep 17 00:00:00 2001 From: Jacob Sharples <45126111+JacobSharples@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:25:33 -0500 Subject: [PATCH 32/32] Update prices_avalanche_c_tokens.sql (#7336) * Update prices_avalanche_c_tokens.sql Added missing prices for Avalanche tokens * Update prices_avalanche_c_tokens.sql * Update prices_avalanche_c_tokens.sql TUS and CRA not active anymore * remove inactive token --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com> --- .../avalanche_c/prices_avalanche_c_tokens.sql | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql b/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql index b32b0651bd6..6fa223a52c3 100644 --- a/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql @@ -92,5 +92,19 @@ FROM ('hon-heroes-of-nft','avalanche_c','HON',0xed2b42d3c9c6e97e11755bb37df29b6375ede3eb,18), ('bawls-bawls-onu','avalanche_c','BAWLS',0x2da8312e2c08b79104c6b18ba26bc7065abec704,18), ('shrap-shrapnel', 'avalanche_c', 'SHRAP', 0xd402298a793948698b9a63311404fbbee944eafd, 18), - ('bal-balancer', 'avalanche_c', 'BAL', 0xe15bcb9e0ea69e6ab9fa080c4c4a5632896298c3, 18) + ('bal-balancer', 'avalanche_c', 'BAL', 0xe15bcb9e0ea69e6ab9fa080c4c4a5632896298c3, 18), + ('ausd-agora-dollar', 'avalanche_c', 'AUSD', 0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a, 6), + ('stg-stargatetoken', 'avalanche_c', 'STG', 0x2F6F07CDcf3588944Bf4C42aC74ff24bF56e7590, 18), + --('tus-treasure-under-sea', 'avalanche_c', 'TUS', 0xf693248f96fe03422fea95ac0afbbbc4a8fdd172, 18), + --('cra-crabada', 'avalanche_c', 'CRA', 0xa32608e873f9ddef944b24798db69d80bbb4d1ed, 18), + ('gmx-gmx', 'avalanche_c', 'GMX', 0x62edc0692bd897d2295872a9ffcac5425011c661, 18), + ('klo-kalao', 'avalanche_c', 'KLO', 0xb27c8941a7df8958a1778c0259f76d1f8b711c35, 18), + ('solvbtc-solv-protocol-solvbtc', 'avalanche_c', 'SolvBTC', 0xbc78d84ba0c46dfe32cf2895a19939c86b81a777, 18), + ('sb-snowbank', 'avalanche_c', 'SB', 0x7d1232b90d3f809a54eeaeebc639c62df8a8942f, 9), + ('euroc-euro-coin', 'avalanche_c', 'EURC', 0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD, 6), + ('renbtc-renbtc', 'avalanche_c', 'renBTC', 0xdbf31df14b66535af65aac99c32e9ea844e14501, 8), + ('arena-the-arena', 'avalanche_c', 'ARENA', 0xb8d7710f7d8349a506b75dd184f05777c82dad0c, 18), + ('zro-layerzero', 'avalanche_c', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18), + ('beam-beam-eth', 'avalanche_c', 'BEAM', 0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce, 18) + ) as temp (token_id, blockchain, symbol, contract_address, decimals)