Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add padre bot #7496

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -777,3 +777,43 @@ models:
- check_bot_trades_seed:
seed_file: ref('sanji_solana_trades_seed')
blockchain: solana

- name: padre_solana_bot_trades
meta:
blockchain: solana
sector: dex
project: padre
contributors: clizzard
config:
tags: ["solana", "dex", "padre", "trades"]
description: >
Padre 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('padre_solana_trades_seed')
blockchain: solana

- name: padre_solana_bot_users
meta:
blockchain: solana
sector: dex
project: padre
contributors: whale_hunter
description: >
padre users on Solana
config:
tags: ["solana", "dex", "bot_trades"]
columns:
- name: user
data_tests: unique
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- user
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{{
config(
alias="bot_trades",
schema="padre_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-07-28" %}
{% set fee_receiver_1 = "J5XGHmzrRmnYWbmw45DbYkdZAU2bwERFZ11qCDXPvFB5" %}
{% set wsol_token = "So11111111111111111111111111111111111111112" %}

with
users as (
select * from {{ref('padre_solana_bot_users')}}
),
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,
0 as fee_usd,
0 AS fee_token_amount,
'SOL' as fee_token_symbol,
'{{wsol_token}}' 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 users on trader_id = user
where
{% if is_incremental() %} {{ incremental_predicate("trades.block_time") }}
{% else %} 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,
'Padre' 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{
config(
alias='bot_users',
schema='padre_solana',
materialized='incremental',
file_format='delta',
incremental_strategy='merge',
unique_key='user'
)
}}

{% set project_start_date = "2024-07-28" %}
{% set fee_receiver = "J5XGHmzrRmnYWbmw45DbYkdZAU2bwERFZ11qCDXPvFB5" %}


select distinct
signer as user
from {{ source('solana', 'account_activity') }} as activity
inner join {{ source("solana", "transactions") }} as transactions
on tx_id = id
and transactions.block_time = activity.block_time
{% if is_incremental() %}
and {{ incremental_predicate('activity.block_time') }}
and {{ incremental_predicate('transactions.block_time') }}
{% else %}
and activity.block_time >= timestamp '{{project_start_date}}'
and transactions.block_time >= timestamp '{{project_start_date}}'
{% endif %}
where
tx_success
and balance_change > 0
and address = '{{fee_receiver}}'
21 changes: 21 additions & 0 deletions dbt_subprojects/solana/seeds/padre/padre_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-07-29 03:09:46.000 UTC,2024-07-29,2024-07-01,Padre,solana,4342.064413034531,Sell,22.531598843,SOL,So11111111111111111111111111111111111111112,901975.039143,schizo,8sWKTMrh9bWUrvykK4H3jzEzGbEqvJNpS2f7joYKpump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-schizo,BeT4ArJs2aFpnxm5Mk6cbpSzMRCP2QUiZpHgtcTu18za,EvtcrTLCvF8i1B34oZXWH51UBQHBBzYeb7hEXMftwxDS,2oozDxT679MJYmg9jBjugfB4wpEbQKktA3D2Dp9ux4kEonj4XXi48oAymYqUUqxFKvMkXAriQfew4uzjMjJfca7F,1040,5,0,true
2024-07-29 03:16:22.000 UTC,2024-07-29,2024-07-01,Padre,solana,2708.4800701477,Sell,14.059071218,SOL,So11111111111111111111111111111111111111112,188409.841644,nomnom,6ZrYhkwvoYE4QqzpdzJ7htEHwT2u2546EkTNJ7qepump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-nomnom,Fhmjp6SMtmD8GXkq8tw6aZjBk3sDpKtKKSH6RToLAX3m,EvtcrTLCvF8i1B34oZXWH51UBQHBBzYeb7hEXMftwxDS,4k5nuVwzhpSQNiFGgnv6NMFrXJScpj6sUTpneNveUEKdXQmSaQBV9d7MuGxqqfosgX2sbxy6tG8VQwvzhjjpoMdm,1011,5,0,true
2024-07-29 03:14:07.000 UTC,2024-07-29,2024-07-01,Padre,solana,1254.2153435262,Sell,6.51168342,SOL,So11111111111111111111111111111111111111112,8818837.982308,MAXXING,F2GVPgWyN4yBSv8zmSw9TmgunQcv7K7MzceFVZzxpump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MAXXING,FPDReqibT45v49cfZ1UJcFDerZU73oHFS9CkpzHZyWGH,EvtcrTLCvF8i1B34oZXWH51UBQHBBzYeb7hEXMftwxDS,64Jhz8dPECEptVjyUfL85CsFsuLG7vdsUf5bW2yoNFJ3rtM7X8hxPuU8vLWnzVsHKCibZDDUdRKWbmtVBPeVdbw8,189,5,0,true
2024-07-28 22:52:44.000 UTC,2024-07-28,2024-07-01,Padre,solana,773.38533484703,Sell,4.224533429,SOL,So11111111111111111111111111111111111111112,979444.414913,KNOCKED,7EvQv9xDvLNDDmPxgrt7D11U8RPFgKjd2KUnPNqKcsbg,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-KNOCKED,BCgJt1H9JFkM7BkMyDxViRFoh7xKBPZizM596rWDPhrh,8nsijy3H9LkjGAgWTRKrhtQqj6Ju5uzxZFaoGKU4Xqpy,4WYmYATpNMtk2yVSah6QevYmtEZAqU47arXKw3PcshoXFvsMSgiZUEpxEzm7zj3UnGNAuyMuoR4EUd9FUjppz4nn,1184,5,0,true
2024-07-30 19:53:23.000 UTC,2024-07-30,2024-07-01,Padre,solana,102.58591137975,Sell,0.577135929,SOL,So11111111111111111111111111111111111111112,481090.8646,WADDUP,7z5d8Je3JH5nENwgfDYt755hG3NGUnvgBgTBoka6nF2S,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,WADDUP-SOL,EVLrQHHDuAobUfDQ9Vu9ZCDtxBKRgLVPmDFrTTNenzj2,GQvbUyFERsYEYzYRwmAHT4sQuX3SqGMFNnT1ok6WMDaq,RPdEF9gLhEPzLaetBZrXBpp2Sm7HQbG8RtxW1ZaBwpVwZwUCjuni3i8bC4JmiR1H58sEwcRSEJdjj7GekkQCb9p,1208,4,1,true
2024-07-28 14:34:46.000 UTC,2024-07-28,2024-07-01,Padre,solana,37.042,Buy,345807.758507,MUMI,E3g4eBhwiieY6rMMtsXdTqjsGPTG5J7akSYAsm3fGqeK,0.2,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MUMI,ACTXLXqL7V7nrw952PEoHFjHag9u4TDdfhFRHyaCWPU,ED3hJpjoC2GVuqm5EAaJNVh3iHy3R9pS1SQ8BtqM9VSY,idkF2fWEv8pCr9eZq2rm6gABBQJVVH55fV9xdoaMnSnNcSuQ1skkAffC8tSGWSjMwBYesQyVd3EBDMq1z6gJkVj,1550,2,6,true
2024-07-28 00:43:30.000 UTC,2024-07-28,2024-07-01,Padre,solana,183.14010000000002,Buy,26007.251225,NEIRO,CTg3ZgYx79zrE1MteDVkmkcGniiFrK1hJ6yiabropump,0.99,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-NEIRO,HvAqakZgurMR2br1eGWPU6EeFcxzmeW8n6Mn7ejEf3DV,8nsijy3H9LkjGAgWTRKrhtQqj6Ju5uzxZFaoGKU4Xqpy,2iYz4AXGnQm2dS6zBY14HzCBtsEjYGCHn3fX3BKdqmYq2QmGAR1cJ7BjBcKdDdN1KfwHUCh45NkBfSeFaLUfkhYg,2725,5,0,true
2024-07-28 10:44:08.000 UTC,2024-07-28,2024-07-01,Padre,solana,40.74339115008,Sell,0.221047044,SOL,So11111111111111111111111111111111111111112,180827.091232,WIFNEIRO,3zmTDxKuANbHWtkLCKLXEByrrP1PqCgN9wCqk2ePpump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,WIFNEIRO-SOL,5P7NaLqeozNC5rK1GncMVH98rzq1TGXEwJtgGEydu9Xf,DXLX3jgL1su1C73k8ixvepAz5y29UdXKesXjiXFgtHQP,2U9Ngk3agPmsFhC5fDNV3tESkRF7aRBJ7ustqTMt1z3Dsgn2NegmoMbUT4bw7g5utbStpQpp3ja3uZsYB2jMg3bp,180,4,1,true
2024-07-29 00:42:07.000 UTC,2024-07-29,2024-07-01,Padre,solana,183.524003081748,Buy,183.712676,USDC,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,0.977302816,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,lifinity,2,USDC-SOL,86eq4kdBkUCHGdCC2SfcqGHRCBGhp2M89aCmuvvxaXsm,5ygynpzLGWfSZn3oS5Eu3iCMHkEQpopzdfRhL2M7oSwE,5QmdnwJFZFkwmfM5B9fDWMBTUi59c7PQBXDB7DddJDjKsebrDLeUyjXB8PFAfN15UucT45k7fQf2Jjwr7a3kJV6Z,106,3,6,true
2024-07-29 04:20:19.000 UTC,2024-07-29,2024-07-01,Padre,solana,3.8407999999999998,Buy,161.644336,NEIRO,CTg3ZgYx79zrE1MteDVkmkcGniiFrK1hJ6yiabropump,0.02,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-NEIRO,HvAqakZgurMR2br1eGWPU6EeFcxzmeW8n6Mn7ejEf3DV,3qxNDrVsmag4YPbcN2vmPZbNDK7aCmojweAcbjHjwFNM,5CWA1n172WLCynmQue2kPf5Rv5zSKnYHHEa9wCYQLsyXQtvFZjDDd3Q23Lx4RFAYrnAWn9tia9F8C2jCeZskBpLd,264,6,0,true
2024-07-28 11:43:28.000 UTC,2024-07-28,2024-07-01,Padre,solana,48.1700458395,Sell,0.260027238,SOL,So11111111111111111111111111111111111111112,115050.920169,WIFNEIRO,3zmTDxKuANbHWtkLCKLXEByrrP1PqCgN9wCqk2ePpump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,WIFNEIRO-SOL,5P7NaLqeozNC5rK1GncMVH98rzq1TGXEwJtgGEydu9Xf,DXLX3jgL1su1C73k8ixvepAz5y29UdXKesXjiXFgtHQP,5rV5ViYtmZdDViChmXMw3Pyv4r3w3wYXZwupfjduTAhGobfadKK9XBAs921HfHM1WMUkKg5VzBz28X6j24BK4JoV,89,4,1,true
2024-07-28 06:41:17.000 UTC,2024-07-28,2024-07-01,Padre,solana,1802.8890000000001,Buy,254843.411269,ong,358PuxphAQ26nktpniGzcooT1u3TZEsE2HmWgQUMpump,9.9,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-ong,8p7SxnBgw9hghfKnADeKGXDUBDm5L3M24Zd1yzXPuu7m,8nsijy3H9LkjGAgWTRKrhtQqj6Ju5uzxZFaoGKU4Xqpy,WsJeZxGsiNfygva4HEVZyMwjcfwAGrcCBHdxvSXbpJbNpWr35Wc8m3kgmkiUUM3aKzwu4FJrTRDvQVECpPLYooM,93,5,0,true
2024-07-28 01:28:05.000 UTC,2024-07-28,2024-07-01,Padre,solana,390.98506778859,Sell,2.099474133,SOL,So11111111111111111111111111111111111111112,1355263.727115,neiro,3V9KFwFJn9pScbnSCFyr2qTibpbWExV1nMryES2Ppump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-neiro,GB1yyzxVJ5KVFpKgY36T2nGWPCmBhQ2Rzpf31Tv3WTYU,8nsijy3H9LkjGAgWTRKrhtQqj6Ju5uzxZFaoGKU4Xqpy,5bWtRShoXUArWYXsbpCoicXoCw7axh1aTTd9ZT2wopyTF6CvPoacAaStpd1TPBnWU8L35VcBec6PdBLS1e4fAbQT,18,5,0,true
2024-07-28 23:44:49.000 UTC,2024-07-28,2024-07-01,Padre,solana,406.81369342200003,Sell,2.20316108,SOL,So11111111111111111111111111111111111111112,1364941.357955,Real,AD8HAcdNzLSAeh57VotePz3tn7EQGF3gSAevQ1hGpump,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Real,9po5SNMNMU9rmwjjMLdN5QFa3KApphjqkUyQN4PGn9M5,8FHmXVGeyszEk2kACRTZQ35rgFnsoCn94321w2odhQqX,4LMWkHJggzbY52TC6Q5gU21BZZ53XoUFqwd3xmubZJNWQwDFahjVcsT71HsNnvHHEBzYmfN3zrAMtNNJ6Qgf2E5b,83,3,0,true
2024-07-30 07:17:52.000 UTC,2024-07-30,2024-07-01,Padre,solana,61.693527707739996,Sell,0.336865391,SOL,So11111111111111111111111111111111111111112,34671.208275033,,CATEkkXvRpQdEZfd8z5uMEptkbmETbEfApPJEHBJDQrJ,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,,8DhfruYZ5PRbhgVtU1yaJDE4rgLHDUN1dHTeMuNkn1iZ,FrvYN7DGZvnv3QYsTt3yYm3gT2A5gkCQhgbyzYfKH4jb,3TK7KpgZtj9yH8o9g1HFqBq5mxAePHMDeRKihgu1vXXtkBS2jC2BYNjsJVvdTaEgC1SPr3yq4kCnDmY2J6iwHx1B,1057,5,1,true
2024-07-28 16:50:14.000 UTC,2024-07-28,2024-07-01,Padre,solana,9.221,Buy,1466828.888015,QTIP,4J3RYcnunRYUURXwgYiyvReJXLKHJcFi2WtYSQi1pump,0.05,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,pumpdotfun,1,SOL-QTIP,EKNNiWwYL3i4w19sGDfAhdkJ7f3qfYxiJitY4a85M2ef,DAHUU16ALEBkp9jF35mmfTvSNVyNzNJK5UR9YrhC6BGg,4R9toxJ8RL8TujsGTAjR6C4V6A4S5vhWJsUa7FUhYWcxBFh7KZ7xap1uecqwLSeMYk32BNh8DyuUnKxWDVJUdrdL,43,4,4,true
2024-07-30 14:52:04.000 UTC,2024-07-30,2024-07-01,Padre,solana,0.006401098439999999,Sell,0.000035332,SOL,So11111111111111111111111111111111111111112,41.313000817,SIMBA,FwTkVa9gVRdXg1zR6dqSqr6EQpTjBWHNiwmAhBEtHmwc,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SIMBA,FoRSDXpf8L5BnsUMPRq79eSUVC7ZHaNCPa5ypy2KVyes,627vtWXuV97MZFqBzZJx3BmDj9yycguWqDb1aXBoa1eP,4uHqgdNhUdmC7VGJPzmKd6rc2GCH2vhq5QXtktwwKiNhWcrX9wMJo45WbaxYbLbvogMmH4onD2PVZKscQQpGnswp,66,6,0,true
2024-07-30 19:56:24.000 UTC,2024-07-30,2024-07-01,Padre,solana,18.45030568608,Sell,0.103635936,SOL,So11111111111111111111111111111111111111112,120272.7161,WADDUP,7z5d8Je3JH5nENwgfDYt755hG3NGUnvgBgTBoka6nF2S,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,WADDUP-SOL,EVLrQHHDuAobUfDQ9Vu9ZCDtxBKRgLVPmDFrTTNenzj2,GQvbUyFERsYEYzYRwmAHT4sQuX3SqGMFNnT1ok6WMDaq,5bYhKZqL1UZwvXD3LaKwVQpvFAWfRkXt5oTBVVku3oFx15U7bTow8eQ2nMW7g1jXb1HU3PGDvtHBGjDqJQwfqMFn,558,4,1,true
2024-07-28 01:24:41.000 UTC,2024-07-28,2024-07-01,Padre,solana,919.3634999999999,Buy,1355263.727115,neiro,3V9KFwFJn9pScbnSCFyr2qTibpbWExV1nMryES2Ppump,4.95,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-neiro,GB1yyzxVJ5KVFpKgY36T2nGWPCmBhQ2Rzpf31Tv3WTYU,8nsijy3H9LkjGAgWTRKrhtQqj6Ju5uzxZFaoGKU4Xqpy,4hZeMtVdNKCsuN6Mfyc5HcVdt8JeKAMLTUdo3AwCYD52n6tNQFjMJEV7YAmfZzLAzX59z3wHCAMU7UBDS6GuRdbb,72,6,0,true
2024-07-28 14:13:50.000 UTC,2024-07-28,2024-07-01,Padre,solana,185.9,Buy,7700.720547,NEIRO,CTg3ZgYx79zrE1MteDVkmkcGniiFrK1hJ6yiabropump,1,SOL,So11111111111111111111111111111111111111112,0,0,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-NEIRO,HvAqakZgurMR2br1eGWPU6EeFcxzmeW8n6Mn7ejEf3DV,4YaMSrppjbBGzzfGVKKBMnPNuABE9QaA5fJ1mzY6bwot,5pHGRjFt8J4XxbjDTHUBdgvquymLfK2Md1YFurvY5r1QPbppAyDetjEtdHdWuzT2oXkd1BEYiZ8Hv9dySSBGCfP6,2861,6,1,true
Loading