diff --git a/dbt_subprojects/dex/models/_projects/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql b/dbt_subprojects/dex/models/_projects/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql index 635d3fb2724..2061a3ddc8b 100644 --- a/dbt_subprojects/dex/models/_projects/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql +++ b/dbt_subprojects/dex/models/_projects/kyberswap/avalanche_c/kyberswap_aggregator_avalanche_c_trades.sql @@ -1,6 +1,6 @@ {{ config ( - + schema = 'kyberswap_aggregator_avalanche_c', alias = 'trades', partition_by = ['block_month'], @@ -36,8 +36,11 @@ WITH meta_router AS ,ARRAY[-1] AS trace_address FROM {{ source('kyber_avalanche_c', 'MetaAggregationRouterV2_evt_Swapped') }} + WHERE 0x250f8f7750735e3ab5dc9db3a542f6b71999ed38 not in (dstToken, srcToken) + -- There are 2 weird transactions with this token where the return and spent amounts in the event are not correct + -- these result in inflated volume, so we'll ignore this token in any trades. {% if is_incremental() %} - WHERE evt_block_time >= date_trunc('day', now() - INTERVAL '7' DAY) + AND evt_block_time >= date_trunc('day', now() - INTERVAL '7' DAY) {% endif %} ) SELECT 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 %} 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) diff --git a/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql b/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql index 2cc0457de62..00c4e28e4b5 100644 --- a/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql @@ -193,5 +193,15 @@ FROM ('alb-alienbase', 'base', 'ALB',0x1dd2d631c92b1acdfcdd51a0f7145a50130050c4, 18), ('clark-coinbase-mascot','base','CLARK',0x5f7373Fa845692b1dD7bfaE576D6c743482bf26a, 18), ('gyd-gyro-dollar','base','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), - ('virtual-virtual-protocol', 'base', 'VIRTUAL', 0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b, 18) + ('virtual-virtual-protocol', 'base', 'VIRTUAL', 0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b, 18), + ('bomb-fbomb', 'base', 'BOMB', 0x74ccbe53f77b08632ce0cb91d3a545bf6b8e0979, 18), + ('play9-play', 'base', 'PLAY', 0x7404ac09adf614603d9c16a7ce85a1101f3514ba, 18), + ('champ-super-champs', 'base', 'CHAMP', 0xeb6d78148f001f3aa2f588997c5e102e489ad341, 18), + ('euroc-euro-coin', 'base', 'EURC', 0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42, 6), + ('fai-freysa', 'base', 'FAI', 0xb33ff54b9f7242ef1593d2c9bcd8f9df46c77935, 18), + ('ogn-origin-protocol', 'base', 'OGN', 0x7002458b1df59eccb57387bc79ffc7c29e22e6f7, 18), + ('usdt-tether', 'base', 'USDT', 0xfde4c96c8593536e31f229ea8f37b2ada2699bb2, 6), + ('klima-klimadao', 'base', 'KLIMA', 0xdcefd8c8fcc492630b943abcab3429f12ea9fea2, 9), + ('yfi-yearnfinance', 'base', 'YFI', 0x9eaf8c1e34f05a589eda6bafdf391cf6ad3cb239, 18) + --('well-moonwell' ,'base', 'WELL', 0xa88594d404727625a9437c3f886c7643872296ae, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql b/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql index 78c535ee76b..61dafea3763 100644 --- a/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1870,7 +1870,8 @@ FROM ('sigma2-sigma', 'ethereum', 'SIGMA', 0x18a8D75F70eAEad79B5A55903D036ce337F623A5, 18), ('mstr-mstr2100', 'ethereum', 'MSTR', 0x42069026EAC8Eee0Fd9b5f7aDFa4f6E6D69a2B39, 9), ('usdl-lift-dollar', 'ethereum', 'USDL', 0xbdC7c08592Ee4aa51D06C27Ee23D5087D65aDbcD, 18), - ('usr-resolv-usr', 'ethereum', 'USR', 0x66a1e37c9b0eaddca17d3662d6c05f4decf3e110, 18) + ('usr-resolv-usr', 'ethereum', 'USR', 0x66a1e37c9b0eaddca17d3662d6c05f4decf3e110, 18), + ('sovrn-sovrun','ethereum', 'SOVRN', 0x031B8d752d73d7Fe9678ACEf26e818280D0646b4, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) where contract_address not in ( -- bad price feeds diff --git a/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql index 978c1669a8c..e7bc5483e81 100644 --- a/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_native_tokens.sql @@ -88,5 +88,6 @@ FROM ('ton-toncoin', null, 'TON', null,null), ('strk-starknet', null, 'STRK', null,null), ('kda-kadena', null, 'KDA', null, null), - ('ron-ronin-token', null, 'RON', null, null) + ('ron-ronin-token', null, 'RON', null, null), + ('hype-hyperliquid', null, 'HYPE', null, null) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql b/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql index 6feb9cdbd4d..9ba81a4fa10 100644 --- a/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/solana/prices_solana_tokens.sql @@ -710,5 +710,10 @@ FROM ('goat-goatseus-maximus', 'solana', 'GOAT', 'CzLSujWBLFsSjncfkh59rUFqvafWcY5tzedWJSuypump', 6), ('fwog-fwog', 'solana', 'FWOG', 'A8C3xuqscfmyLrte3VmTqrAq8kgMASius9AFNANwpump', 6), ('lester-litecoin-mascot', 'solana', 'LESTER', '5z3iCe53hUANTiG8Js8RjHNE2Arjik7L2CXLyr2rpump', 6), - ('happy-happycat', 'solana', 'HAPPY', 'HAPPYwgFcjEJDzRtfWE6tiHE9zGdzpNky2FvjPHsvvGZ', 9) + ('happy-happycat', 'solana', 'HAPPY', 'HAPPYwgFcjEJDzRtfWE6tiHE9zGdzpNky2FvjPHsvvGZ', 9), + ('memesai-memes-ai', 'solana', 'MEMESAI', '39qibQxVzemuZTEvjSB7NePhw9WyyHdQCqP8xmBMpump', 6), + ('grift1-orbit', 'solana', 'GRIFT', 'GekTNfm84QfyP2GdAHZ5AgACBRd69aNmgA5FDhZupump', 6), + ('fxn-fxn', 'solana', 'FXN', '92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump',6), + ('griffain-test-griffaincom', 'solana', 'GRIFFAIN', 'KENJSUYLASHUMfHyy5o4Hp2FdNqZg1AsUPhfH2kYvEP', 6), + ('tank-agenttank', 'solana', 'TANK', 'GAMwtMB6onAvBNBQJCJFuxoaqfPH8uCQ2dewNMVVpump', 6) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql b/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql index a7feaeee8e3..ca5c1937e5b 100644 --- a/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/base/tokens_base_erc20.sql @@ -409,5 +409,6 @@ FROM (VALUES , (0x5f7373Fa845692b1dD7bfaE576D6c743482bf26a, 'CLARK', 18) , (0xBAa5CC21fd487B8Fcc2F632f3F4E8D37262a0842, 'MORPHO', 18) , (0xCA5d8F8a8d49439357d3CF46Ca2e720702F132b8, 'GYD', 18) - , (0xC0D3700000987C99b3C9009069E4f8413fD22330, 'cdxUSD', 18) + , (0xC0D3700000987C99b3C9009069E4f8413fD22330, 'cdxUSD', 18) + , (0xc694a91e6b071bf030a18bd3053a7fe09b6dae69, 'COW', 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 96bf183c18c..c83ece387c6 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4740,4 +4740,5 @@ FROM (VALUES , ( 0xa4f6b2cdcb67bf8f48baa459a333d2667aa4b100, 'shezETH', 8) , ( 0x7F4B66FF703336CfC35b901144614496Ae0b0D27, 'shezUSD', 18) , ( 0xa7b66dda0d7c7c1e43d3130491216172993d163d, 'EVS', 6) + , ( 0x2371e134e3455e0593363cbf89d3b6cf53740618, 'gtWETH', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/sources/_base_sources/other/ton_base_sources.yml b/sources/_base_sources/other/ton_base_sources.yml new file mode 100644 index 00000000000..55770d278b7 --- /dev/null +++ b/sources/_base_sources/other/ton_base_sources.yml @@ -0,0 +1,920 @@ +version: 2 + +sources: + - name: ton + description: "TON blockchain raw data tables" + freshness: + warn_after: { count: 12, period: hour } + error_after: { count: 24, period: hour } + tables: + - name: blocks + loaded_at_field: ingested_at + description: "TON blockchain blocks" + columns: + - name: block_time + description: "Block timestamp" + tests: + - not_null + data_type: timestamp + + - name: block_date + description: "Block date" + tests: + - not_null + data_type: date + + - name: workchain + description: "Workchain identifier" + data_type: integer + + - name: shard + description: "Shard identifier" + data_type: bigint + + - name: seqno + description: "Block sequence number" + data_type: integer + + - name: root_hash + description: "Root hash of the block" + data_type: varchar + + - name: file_hash + description: "File hash of the block" + data_type: varchar + + - name: mc_block_workchain + description: "Masterchain block workchain" + data_type: integer + + - name: mc_block_shard + description: "Masterchain block shard" + data_type: bigint + + - name: mc_block_seqno + description: "Masterchain block sequence number" + data_type: integer + + - name: global_id + description: "Global identifier" + data_type: integer + + - name: version + description: "Block version" + data_type: integer + + - name: after_merge + description: "Flag indicating if block is after merge" + data_type: boolean + + - name: before_split + description: "Flag indicating if block is before split" + data_type: boolean + + - name: after_split + description: "Flag indicating if block is after split" + data_type: boolean + + - name: want_merge + description: "Flag indicating if block wants to merge" + data_type: boolean + + - name: want_split + description: "Flag indicating if block wants to split" + data_type: boolean + + - name: key_block + description: "Flag indicating if block is a key block" + data_type: boolean + + - name: vert_seqno_incr + description: "Vertical sequence number increment flag" + data_type: boolean + + - name: flags + description: "Block flags" + data_type: integer + + - name: gen_utime + description: "Generation unix time" + data_type: bigint + + - name: start_lt + description: "Start logical time" + data_type: bigint + + - name: end_lt + description: "End logical time" + data_type: bigint + + - name: validator_list_hash_short + description: "Short hash of validator list" + data_type: integer + + - name: gen_catchain_seqno + description: "Generation catchain sequence number" + data_type: integer + + - name: min_ref_mc_seqno + description: "Minimum reference masterchain sequence number" + data_type: integer + + - name: prev_key_block_seqno + description: "Previous key block sequence number" + data_type: integer + + - name: vert_seqno + description: "Vertical sequence number" + data_type: integer + + - name: master_ref_seqno + description: "Master reference sequence number" + data_type: integer + + - name: rand_seed + description: "Random seed" + data_type: varchar + + - name: created_by + description: "Block creator address" + data_type: varchar + + - name: tx_count + description: "Number of transactions in block" + data_type: integer + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the block was ingested" + data_type: timestamp + + - name: messages + loaded_at_field: ingested_at + description: "TON blockchain messages" + columns: + - name: block_time + description: "Block timestamp" + data_type: timestamp + + - name: block_date + description: "Block date" + data_type: date + + - name: tx_hash + description: "Transaction hash" + data_type: varchar + + - name: tx_lt + description: "Transaction logical time" + data_type: bigint + + - name: tx_now + description: "Transaction timestamp" + data_type: integer + + - name: msg_hash + description: "Message hash" + data_type: varchar + + - name: direction + description: "Message direction" + data_type: varchar + + - name: trace_id + description: "Trace identifier" + data_type: varchar + + - name: source + description: "Source address" + data_type: varchar + + - name: destination + description: "Destination address" + data_type: varchar + + - name: value + description: "Message value" + data_type: bigint + + - name: fwd_fee + description: "Forward fee" + data_type: bigint + + - name: ihr_fee + description: "IHR fee" + data_type: bigint + + - name: created_lt + description: "Creation logical time" + data_type: bigint + + - name: created_at + description: "Creation timestamp" + data_type: bigint + + - name: opcode + description: "Operation code" + data_type: integer + + - name: ihr_disabled + description: "IHR disabled flag" + data_type: boolean + + - name: bounce + description: "Bounce flag" + data_type: boolean + + - name: bounced + description: "Bounced flag" + data_type: boolean + + - name: import_fee + description: "Import fee" + data_type: bigint + + - name: body_hash + description: "Message body hash" + data_type: varchar + + - name: body_boc + description: "Message body BOC" + data_type: varbinary + + - name: comment + description: "Message comment" + data_type: varchar + + - name: init_state_hash + description: "Initial state hash" + data_type: varchar + + - name: init_state_boc + description: "Initial state BOC" + data_type: varbinary + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the message was ingested" + data_type: timestamp + + - name: transactions + loaded_at_field: ingested_at + description: "TON blockchain transactions" + columns: + - name: block_time + description: "Block timestamp" + data_type: timestamp + + - name: block_date + description: "Block date" + data_type: date + + - name: account + description: "Account address" + data_type: varchar + + - name: hash + description: "Transaction hash" + data_type: varchar + + - name: lt + description: "Logical time" + data_type: bigint + + - name: block_workchain + description: "Block workchain identifier" + data_type: integer + + - name: block_shard + description: "Block shard identifier" + data_type: bigint + + - name: block_seqno + description: "Block sequence number" + data_type: integer + + - name: mc_block_seqno + description: "Masterchain block sequence number" + data_type: integer + + - name: trace_id + description: "Trace identifier" + data_type: varchar + + - name: prev_trans_hash + description: "Previous transaction hash" + data_type: varchar + + - name: prev_trans_lt + description: "Previous transaction logical time" + data_type: bigint + + - name: now + description: "Transaction timestamp" + data_type: integer + + - name: orig_status + description: "Original status" + data_type: varchar + + - name: end_status + description: "End status" + data_type: varchar + + - name: total_fees + description: "Total transaction fees" + data_type: bigint + + - name: account_state_hash_before + description: "Account state hash before transaction" + data_type: varchar + + - name: account_state_hash_after + description: "Account state hash after transaction" + data_type: varchar + + - name: account_state_code_hash_before + description: "Account state code hash before transaction" + data_type: varchar + + - name: account_state_code_hash_after + description: "Account state code hash after transaction" + data_type: varchar + + - name: account_state_balance_before + description: "Account balance before transaction" + data_type: bigint + + - name: account_state_balance_after + description: "Account balance after transaction" + data_type: bigint + + - name: descr + description: "Transaction description" + data_type: varchar + + - name: aborted + description: "Transaction aborted flag" + data_type: boolean + + - name: destroyed + description: "Account destroyed flag" + data_type: boolean + + - name: credit_first + description: "Credit first flag" + data_type: boolean + + - name: is_tock + description: "Is tock transaction flag" + data_type: boolean + + - name: installed + description: "Code installed flag" + data_type: boolean + + - name: storage_fees_collected + description: "Storage fees collected" + data_type: bigint + + - name: storage_fees_due + description: "Storage fees due" + data_type: bigint + + - name: storage_status_change + description: "Storage status change" + data_type: varchar + + - name: credit_due_fees_collected + description: "Credit due fees collected" + data_type: bigint + + - name: credit + description: "Credit amount" + data_type: bigint + + - name: compute_skipped + description: "Compute phase skipped flag" + data_type: boolean + + - name: skipped_reason + description: "Reason for skipping compute phase" + data_type: varchar + + - name: compute_success + description: "Compute phase success flag" + data_type: boolean + + - name: compute_msg_state_used + description: "Message state used in compute phase" + data_type: boolean + + - name: compute_account_activated + description: "Account activated in compute phase" + data_type: boolean + + - name: compute_gas_fees + description: "Gas fees in compute phase" + data_type: bigint + + - name: compute_gas_used + description: "Gas used in compute phase" + data_type: bigint + + - name: compute_gas_limit + description: "Gas limit in compute phase" + data_type: bigint + + - name: compute_gas_credit + description: "Gas credit in compute phase" + data_type: bigint + + - name: compute_mode + description: "Compute phase mode" + data_type: integer + + - name: compute_exit_code + description: "Compute phase exit code" + data_type: integer + + - name: compute_exit_arg + description: "Compute phase exit argument" + data_type: integer + + - name: compute_vm_steps + description: "VM steps in compute phase" + data_type: bigint + + - name: compute_vm_init_state_hash + description: "VM initial state hash" + data_type: varchar + + - name: compute_vm_final_state_hash + description: "VM final state hash" + data_type: varchar + + - name: action_success + description: "Action phase success flag" + data_type: boolean + + - name: action_valid + description: "Action phase validity flag" + data_type: boolean + + - name: action_no_funds + description: "No funds for action phase flag" + data_type: boolean + + - name: action_status_change + description: "Action phase status change" + data_type: varchar + + - name: action_total_fwd_fees + description: "Total forward fees in action phase" + data_type: bigint + + - name: action_total_action_fees + description: "Total action fees" + data_type: bigint + + - name: action_result_code + description: "Action phase result code" + data_type: integer + + - name: action_result_arg + description: "Action phase result argument" + data_type: integer + + - name: action_tot_actions + description: "Total number of actions" + data_type: integer + + - name: action_spec_actions + description: "Number of special actions" + data_type: integer + + - name: action_skipped_actions + description: "Number of skipped actions" + data_type: integer + + - name: action_msgs_created + description: "Number of messages created" + data_type: integer + + - name: action_action_list_hash + description: "Action list hash" + data_type: varchar + + - name: action_tot_msg_size_cells + description: "Total message size in cells" + data_type: bigint + + - name: action_tot_msg_size_bits + description: "Total message size in bits" + data_type: bigint + + - name: bounce + description: "Bounce status" + data_type: varchar + + - name: bounce_msg_size_cells + description: "Bounce message size in cells" + data_type: bigint + + - name: bounce_msg_size_bits + description: "Bounce message size in bits" + data_type: bigint + + - name: bounce_req_fwd_fees + description: "Required forward fees for bounce" + data_type: bigint + + - name: bounce_msg_fees + description: "Bounce message fees" + data_type: bigint + + - name: bounce_fwd_fees + description: "Bounce forward fees" + data_type: bigint + + - name: split_info_cur_shard_pfx_len + description: "Current shard prefix length" + data_type: integer + + - name: split_info_acc_split_depth + description: "Account split depth" + data_type: integer + + - name: split_info_this_addr + description: "This address in split info" + data_type: varchar + + - name: split_info_sibling_addr + description: "Sibling address in split info" + data_type: varchar + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the transaction was ingested" + data_type: timestamp + + - name: dex_pools + loaded_at_field: ingested_at + description: "TON DEX pools information" + columns: + - name: block_time + description: "Block timestamp" + data_type: timestamp + + - name: block_date + description: "Block date" + data_type: date + + - name: pool + description: "Pool address" + data_type: varchar + + - name: project + description: "DEX project name" + data_type: varchar + + - name: version + description: "DEX version" + data_type: integer + + - name: discovered_at + description: "Pool discovery timestamp" + data_type: integer + + - name: jetton_left + description: "Left token address" + data_type: varchar + + - name: jetton_right + description: "Right token address" + data_type: varchar + + - name: reserves_left + description: "Left token reserves" + data_type: decimal(38,0) + + - name: reserves_right + description: "Right token reserves" + data_type: decimal(38,0) + + - name: total_supply + description: "Total supply of LP tokens" + data_type: decimal(38,0) + + - name: tvl_usd + description: "Total value locked in USD" + data_type: decimal(20,6) + + - name: tvl_ton + description: "Total value locked in TON" + data_type: decimal(20,9) + + - name: last_updated + description: "Last update timestamp" + data_type: integer + + - name: is_liquid + description: "Liquidity status flag" + data_type: boolean + + - name: lp_fee + description: "LP fee percentage" + data_type: decimal(12,10) + + - name: protocol_fee + description: "Protocol fee percentage" + data_type: decimal(12,10) + + - name: referral_fee + description: "Referral fee percentage" + data_type: decimal(12,10) + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the pool data was ingested" + data_type: timestamp + + - name: dex_trades + loaded_at_field: ingested_at + description: "TON DEX trades information" + columns: + - name: block_time + description: "Block timestamp" + data_type: timestamp + + - name: block_date + description: "Block date" + data_type: date + + - name: tx_hash + description: "Transaction hash" + data_type: varchar + + - name: trace_id + description: "Trace identifier" + data_type: varchar + + - name: project_type + description: "Project type" + data_type: varchar + + - name: project + description: "DEX project name" + data_type: varchar + + - name: version + description: "DEX version" + data_type: integer + + - name: event_time + description: "Event timestamp" + data_type: integer + + - name: event_type + description: "Event type" + data_type: varchar + + - name: trader_address + description: "Trader address" + data_type: varchar + + - name: pool_address + description: "Pool address" + data_type: varchar + + - name: router_address + description: "Router address" + data_type: varchar + + - name: token_sold_address + description: "Sold token address" + data_type: varchar + + - name: token_bought_address + description: "Bought token address" + data_type: varchar + + - name: amount_sold_raw + description: "Raw amount of tokens sold" + data_type: decimal(38,0) + + - name: amount_bought_raw + description: "Raw amount of tokens bought" + data_type: decimal(38,0) + + - name: referral_address + description: "Referral address" + data_type: varchar + + - name: platform_tag + description: "Platform tag" + data_type: varchar + + - name: query_id + description: "Query identifier" + data_type: decimal(20,0) + + - name: volume_usd + description: "Trade volume in USD" + data_type: decimal(20,6) + + - name: volume_ton + description: "Trade volume in TON" + data_type: decimal(20,9) + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the trade was ingested" + data_type: timestamp + + - name: jetton_events + loaded_at_field: ingested_at + description: "TON jetton events" + columns: + - name: block_time + description: "Block timestamp" + data_type: timestamp + + - name: block_date + description: "Block date" + data_type: date + + - name: type + description: "Event type" + data_type: varchar + + - name: tx_hash + description: "Transaction hash" + data_type: varchar + + - name: tx_lt + description: "Transaction logical time" + data_type: bigint + + - name: utime + description: "Unix timestamp" + data_type: integer + + - name: trace_id + description: "Trace identifier" + data_type: varchar + + - name: tx_aborted + description: "Transaction aborted flag" + data_type: boolean + + - name: query_id + description: "Query identifier" + data_type: decimal(20,0) + + - name: amount + description: "Token amount" + data_type: decimal(38,0) + + - name: source + description: "Source address" + data_type: varchar + + - name: destination + description: "Destination address" + data_type: varchar + + - name: jetton_wallet + description: "Jetton wallet address" + data_type: varchar + + - name: jetton_master + description: "Jetton master contract address" + data_type: varchar + + - name: response_destination + description: "Response destination address" + data_type: varchar + + - name: custom_payload + description: "Custom payload data" + data_type: varbinary + + - name: forward_ton_amount + description: "Forward TON amount" + data_type: decimal(38,0) + + - name: forward_payload + description: "Forward payload data" + data_type: varbinary + + - name: comment + description: "Event comment" + data_type: varchar + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the event was ingested" + data_type: timestamp + + - name: jetton_metadata + loaded_at_field: ingested_at + description: "TON jetton metadata" + columns: + - name: address + description: "Jetton address" + data_type: varchar + + - name: update_time_onchain + description: "On-chain update timestamp" + data_type: integer + + - name: update_time_metadata + description: "Metadata update timestamp" + data_type: integer + + - name: mintable + description: "Mintable flag" + data_type: boolean + + - name: admin_address + description: "Admin address" + data_type: varchar + + - name: jetton_content_onchain + description: "On-chain jetton content" + data_type: varchar + + - name: jetton_wallet_code_hash + description: "Jetton wallet code hash" + data_type: varchar + + - name: code_hash + description: "Contract code hash" + data_type: varchar + + - name: metadata_status + description: "Metadata status" + data_type: integer + + - name: symbol + description: "Token symbol" + data_type: varchar + + - name: name + description: "Token name" + data_type: varchar + + - name: description + description: "Token description" + data_type: varchar + + - name: image + description: "Token image URL" + data_type: varchar + + - name: image_data + description: "Token image data" + data_type: varchar + + - name: decimals + description: "Token decimals" + data_type: integer + + - name: sources + description: "Original metadata sources" + data_type: row(symbol varchar, name varchar, description varchar, image varchar, image_data varchar, decimals varchar) + + - name: tonapi_image_url + description: "TON API image URL" + data_type: varchar + + - name: adding_date + description: "Token adding timestamp" + data_type: integer + + - name: updated_at + description: "Last update timestamp" + data_type: timestamp + + - name: ingested_at + description: "Time at which the metadata was ingested" + data_type: timestamp