pub mod admin_set_coin_creator_row;
pub mod admin_update_token_incentives_row;
pub mod buy_exact_quote_in_row;
pub mod buy_row;
pub mod claim_cashback_row;
pub mod claim_token_incentives_row;
pub mod close_user_volume_accumulator_row;
pub mod collect_coin_creator_fee_row;
pub mod cpi_event_row;
pub mod create_config_row;
pub mod create_pool_row;
pub mod deposit_row;
pub mod disable_row;
pub mod extend_account_row;
pub mod init_user_volume_accumulator_row;
pub mod migrate_pool_coin_creator_row;
pub mod sell_row;
pub mod set_coin_creator_row;
pub mod set_reserved_fee_recipients_row;
pub mod sync_user_volume_accumulator_row;
pub mod toggle_cashback_enabled_row;
pub mod toggle_mayhem_mode_row;
pub mod transfer_creator_fees_to_pump_row;
pub mod update_admin_row;
pub mod update_fee_config_row;
pub mod withdraw_row;
pub use self::{
admin_set_coin_creator_row::*, admin_update_token_incentives_row::*, buy_exact_quote_in_row::*,
buy_row::*, claim_cashback_row::*, claim_token_incentives_row::*,
close_user_volume_accumulator_row::*, collect_coin_creator_fee_row::*, cpi_event_row::*,
create_config_row::*, create_pool_row::*, deposit_row::*, disable_row::*,
extend_account_row::*, init_user_volume_accumulator_row::*, migrate_pool_coin_creator_row::*,
sell_row::*, set_coin_creator_row::*, set_reserved_fee_recipients_row::*,
sync_user_volume_accumulator_row::*, toggle_cashback_enabled_row::*, toggle_mayhem_mode_row::*,
transfer_creator_fees_to_pump_row::*, update_admin_row::*, update_fee_config_row::*,
withdraw_row::*,
};
use super::PumpSwapInstruction;
pub struct PumpSwapInstructionsMigration;
impl sqlx_migrator::Migration<sqlx::Postgres> for PumpSwapInstructionsMigration {
fn app(&self) -> &str {
"pump-swap"
}
fn name(&self) -> &str {
"pump_swap_instructions"
}
fn operations(&self) -> Vec<Box<dyn sqlx_migrator::Operation<sqlx::Postgres>>> {
vec![
Box::new(AdminSetCoinCreatorMigrationOperation),
Box::new(AdminUpdateTokenIncentivesMigrationOperation),
Box::new(BuyMigrationOperation),
Box::new(BuyExactQuoteInMigrationOperation),
Box::new(ClaimCashbackMigrationOperation),
Box::new(ClaimTokenIncentivesMigrationOperation),
Box::new(CloseUserVolumeAccumulatorMigrationOperation),
Box::new(CollectCoinCreatorFeeMigrationOperation),
Box::new(CreateConfigMigrationOperation),
Box::new(CreatePoolMigrationOperation),
Box::new(DepositMigrationOperation),
Box::new(DisableMigrationOperation),
Box::new(ExtendAccountMigrationOperation),
Box::new(InitUserVolumeAccumulatorMigrationOperation),
Box::new(MigratePoolCoinCreatorMigrationOperation),
Box::new(SellMigrationOperation),
Box::new(SetCoinCreatorMigrationOperation),
Box::new(SetReservedFeeRecipientsMigrationOperation),
Box::new(SyncUserVolumeAccumulatorMigrationOperation),
Box::new(ToggleCashbackEnabledMigrationOperation),
Box::new(ToggleMayhemModeMigrationOperation),
Box::new(TransferCreatorFeesToPumpMigrationOperation),
Box::new(UpdateAdminMigrationOperation),
Box::new(UpdateFeeConfigMigrationOperation),
Box::new(WithdrawMigrationOperation),
Box::new(CpiEventMigrationOperation),
]
}
fn parents(&self) -> Vec<Box<dyn sqlx_migrator::Migration<sqlx::Postgres>>> {
vec![]
}
}
pub struct PumpSwapInstructionWithMetadata(
pub PumpSwapInstruction,
pub carbon_core::instruction::InstructionMetadata,
pub Vec<solana_instruction::AccountMeta>,
);
impl
From<(
PumpSwapInstruction,
carbon_core::instruction::InstructionMetadata,
Vec<solana_instruction::AccountMeta>,
)> for PumpSwapInstructionWithMetadata
{
fn from(
value: (
PumpSwapInstruction,
carbon_core::instruction::InstructionMetadata,
Vec<solana_instruction::AccountMeta>,
),
) -> Self {
PumpSwapInstructionWithMetadata(value.0, value.1, value.2)
}
}
#[async_trait::async_trait]
impl carbon_core::postgres::operations::Insert for PumpSwapInstructionWithMetadata {
async fn insert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
let PumpSwapInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) = self;
match decoded_instruction {
PumpSwapInstruction::AdminSetCoinCreator { data, .. } => {
let row = admin_set_coin_creator_row::AdminSetCoinCreatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::AdminUpdateTokenIncentives { data, .. } => {
let row =
admin_update_token_incentives_row::AdminUpdateTokenIncentivesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::Buy { data, .. } => {
let row = buy_row::BuyRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::BuyExactQuoteIn { data, .. } => {
let row = buy_exact_quote_in_row::BuyExactQuoteInRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::ClaimCashback { data, .. } => {
let row = claim_cashback_row::ClaimCashbackRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::ClaimTokenIncentives { data, .. } => {
let row = claim_token_incentives_row::ClaimTokenIncentivesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::CloseUserVolumeAccumulator { data, .. } => {
let row =
close_user_volume_accumulator_row::CloseUserVolumeAccumulatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::CollectCoinCreatorFee { data, .. } => {
let row = collect_coin_creator_fee_row::CollectCoinCreatorFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::CreateConfig { data, .. } => {
let row = create_config_row::CreateConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::CreatePool { data, .. } => {
let row = create_pool_row::CreatePoolRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::Deposit { data, .. } => {
let row = deposit_row::DepositRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::Disable { data, .. } => {
let row = disable_row::DisableRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::ExtendAccount { data, .. } => {
let row = extend_account_row::ExtendAccountRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::InitUserVolumeAccumulator { data, .. } => {
let row =
init_user_volume_accumulator_row::InitUserVolumeAccumulatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::MigratePoolCoinCreator { data, .. } => {
let row = migrate_pool_coin_creator_row::MigratePoolCoinCreatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::Sell { data, .. } => {
let row = sell_row::SellRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::SetCoinCreator { data, .. } => {
let row = set_coin_creator_row::SetCoinCreatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::SetReservedFeeRecipients { data, .. } => {
let row = set_reserved_fee_recipients_row::SetReservedFeeRecipientsRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::SyncUserVolumeAccumulator { data, .. } => {
let row =
sync_user_volume_accumulator_row::SyncUserVolumeAccumulatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::ToggleCashbackEnabled { data, .. } => {
let row = toggle_cashback_enabled_row::ToggleCashbackEnabledRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::ToggleMayhemMode { data, .. } => {
let row = toggle_mayhem_mode_row::ToggleMayhemModeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::TransferCreatorFeesToPump { data, .. } => {
let row =
transfer_creator_fees_to_pump_row::TransferCreatorFeesToPumpRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::UpdateAdmin { data, .. } => {
let row = update_admin_row::UpdateAdminRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::UpdateFeeConfig { data, .. } => {
let row = update_fee_config_row::UpdateFeeConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::Withdraw { data, .. } => {
let row = withdraw_row::WithdrawRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpSwapInstruction::CpiEvent { data, .. } => {
let row = cpi_event_row::CpiEventRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
}
}
}
#[async_trait::async_trait]
impl carbon_core::postgres::operations::Upsert for PumpSwapInstructionWithMetadata {
async fn upsert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
let PumpSwapInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) = self;
match decoded_instruction {
PumpSwapInstruction::AdminSetCoinCreator { data, .. } => {
let row = admin_set_coin_creator_row::AdminSetCoinCreatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::AdminUpdateTokenIncentives { data, .. } => {
let row =
admin_update_token_incentives_row::AdminUpdateTokenIncentivesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::Buy { data, .. } => {
let row = buy_row::BuyRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::BuyExactQuoteIn { data, .. } => {
let row = buy_exact_quote_in_row::BuyExactQuoteInRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::ClaimCashback { data, .. } => {
let row = claim_cashback_row::ClaimCashbackRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::ClaimTokenIncentives { data, .. } => {
let row = claim_token_incentives_row::ClaimTokenIncentivesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::CloseUserVolumeAccumulator { data, .. } => {
let row =
close_user_volume_accumulator_row::CloseUserVolumeAccumulatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::CollectCoinCreatorFee { data, .. } => {
let row = collect_coin_creator_fee_row::CollectCoinCreatorFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::CreateConfig { data, .. } => {
let row = create_config_row::CreateConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::CreatePool { data, .. } => {
let row = create_pool_row::CreatePoolRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::Deposit { data, .. } => {
let row = deposit_row::DepositRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::Disable { data, .. } => {
let row = disable_row::DisableRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::ExtendAccount { data, .. } => {
let row = extend_account_row::ExtendAccountRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::InitUserVolumeAccumulator { data, .. } => {
let row =
init_user_volume_accumulator_row::InitUserVolumeAccumulatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::MigratePoolCoinCreator { data, .. } => {
let row = migrate_pool_coin_creator_row::MigratePoolCoinCreatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::Sell { data, .. } => {
let row = sell_row::SellRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::SetCoinCreator { data, .. } => {
let row = set_coin_creator_row::SetCoinCreatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::SetReservedFeeRecipients { data, .. } => {
let row = set_reserved_fee_recipients_row::SetReservedFeeRecipientsRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::SyncUserVolumeAccumulator { data, .. } => {
let row =
sync_user_volume_accumulator_row::SyncUserVolumeAccumulatorRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::ToggleCashbackEnabled { data, .. } => {
let row = toggle_cashback_enabled_row::ToggleCashbackEnabledRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::ToggleMayhemMode { data, .. } => {
let row = toggle_mayhem_mode_row::ToggleMayhemModeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::TransferCreatorFeesToPump { data, .. } => {
let row =
transfer_creator_fees_to_pump_row::TransferCreatorFeesToPumpRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::UpdateAdmin { data, .. } => {
let row = update_admin_row::UpdateAdminRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::UpdateFeeConfig { data, .. } => {
let row = update_fee_config_row::UpdateFeeConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::Withdraw { data, .. } => {
let row = withdraw_row::WithdrawRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpSwapInstruction::CpiEvent { data, .. } => {
let row = cpi_event_row::CpiEventRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
}
}
}