Skip to content

Commit

Permalink
add nova (#7307)
Browse files Browse the repository at this point in the history
* add nova

* fixed seed

* rename schema

---------

Co-authored-by: 0xRob <[email protected]>
  • Loading branch information
clizzard7 and 0xRobin authored Dec 16, 2024
1 parent 1ca58e9 commit 39d698d
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions dbt_subprojects/solana/seeds/nova/nova_solana_trades_seed.csv
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 39d698d

Please sign in to comment.