pub mod claim_social_fee_pda_row;
pub mod cpi_event_row;
pub mod create_fee_sharing_config_row;
pub mod create_social_fee_pda_row;
pub mod get_fees_row;
pub mod initialize_fee_config_row;
pub mod initialize_fee_program_global_row;
pub mod reset_fee_sharing_config_row;
pub mod revoke_fee_sharing_authority_row;
pub mod set_authority_row;
pub mod set_claim_rate_limit_row;
pub mod set_disable_flags_row;
pub mod set_social_claim_authority_row;
pub mod transfer_fee_sharing_authority_row;
pub mod update_admin_row;
pub mod update_fee_config_row;
pub mod update_fee_shares_row;
pub mod upsert_fee_tiers_row;
pub use self::{
claim_social_fee_pda_row::*, cpi_event_row::*, create_fee_sharing_config_row::*,
create_social_fee_pda_row::*, get_fees_row::*, initialize_fee_config_row::*,
initialize_fee_program_global_row::*, reset_fee_sharing_config_row::*,
revoke_fee_sharing_authority_row::*, set_authority_row::*, set_claim_rate_limit_row::*,
set_disable_flags_row::*, set_social_claim_authority_row::*,
transfer_fee_sharing_authority_row::*, update_admin_row::*, update_fee_config_row::*,
update_fee_shares_row::*, upsert_fee_tiers_row::*,
};
use super::PumpFeesInstruction;
pub struct PumpFeesInstructionsMigration;
impl sqlx_migrator::Migration<sqlx::Postgres> for PumpFeesInstructionsMigration {
fn app(&self) -> &str {
"pump-fees"
}
fn name(&self) -> &str {
"pump_fees_instructions"
}
fn operations(&self) -> Vec<Box<dyn sqlx_migrator::Operation<sqlx::Postgres>>> {
vec![
Box::new(ClaimSocialFeePdaMigrationOperation),
Box::new(CreateFeeSharingConfigMigrationOperation),
Box::new(CreateSocialFeePdaMigrationOperation),
Box::new(GetFeesMigrationOperation),
Box::new(InitializeFeeConfigMigrationOperation),
Box::new(InitializeFeeProgramGlobalMigrationOperation),
Box::new(ResetFeeSharingConfigMigrationOperation),
Box::new(RevokeFeeSharingAuthorityMigrationOperation),
Box::new(SetAuthorityMigrationOperation),
Box::new(SetClaimRateLimitMigrationOperation),
Box::new(SetDisableFlagsMigrationOperation),
Box::new(SetSocialClaimAuthorityMigrationOperation),
Box::new(TransferFeeSharingAuthorityMigrationOperation),
Box::new(UpdateAdminMigrationOperation),
Box::new(UpdateFeeConfigMigrationOperation),
Box::new(UpdateFeeSharesMigrationOperation),
Box::new(UpsertFeeTiersMigrationOperation),
Box::new(CpiEventMigrationOperation),
]
}
fn parents(&self) -> Vec<Box<dyn sqlx_migrator::Migration<sqlx::Postgres>>> {
vec![]
}
}
pub struct PumpFeesInstructionWithMetadata(
pub PumpFeesInstruction,
pub carbon_core::instruction::InstructionMetadata,
pub Vec<solana_instruction::AccountMeta>,
);
impl
From<(
PumpFeesInstruction,
carbon_core::instruction::InstructionMetadata,
Vec<solana_instruction::AccountMeta>,
)> for PumpFeesInstructionWithMetadata
{
fn from(
value: (
PumpFeesInstruction,
carbon_core::instruction::InstructionMetadata,
Vec<solana_instruction::AccountMeta>,
),
) -> Self {
PumpFeesInstructionWithMetadata(value.0, value.1, value.2)
}
}
#[async_trait::async_trait]
impl carbon_core::postgres::operations::Insert for PumpFeesInstructionWithMetadata {
async fn insert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
let PumpFeesInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) = self;
match decoded_instruction {
PumpFeesInstruction::ClaimSocialFeePda { data, .. } => {
let row = claim_social_fee_pda_row::ClaimSocialFeePdaRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::CreateFeeSharingConfig { data, .. } => {
let row = create_fee_sharing_config_row::CreateFeeSharingConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::CreateSocialFeePda { data, .. } => {
let row = create_social_fee_pda_row::CreateSocialFeePdaRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::GetFees { data, .. } => {
let row = get_fees_row::GetFeesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::InitializeFeeConfig { data, .. } => {
let row = initialize_fee_config_row::InitializeFeeConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::InitializeFeeProgramGlobal { data, .. } => {
let row =
initialize_fee_program_global_row::InitializeFeeProgramGlobalRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::ResetFeeSharingConfig { data, .. } => {
let row = reset_fee_sharing_config_row::ResetFeeSharingConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::RevokeFeeSharingAuthority { data, .. } => {
let row =
revoke_fee_sharing_authority_row::RevokeFeeSharingAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetAuthority { data, .. } => {
let row = set_authority_row::SetAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetClaimRateLimit { data, .. } => {
let row = set_claim_rate_limit_row::SetClaimRateLimitRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetDisableFlags { data, .. } => {
let row = set_disable_flags_row::SetDisableFlagsRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetSocialClaimAuthority { data, .. } => {
let row = set_social_claim_authority_row::SetSocialClaimAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::TransferFeeSharingAuthority { data, .. } => {
let row =
transfer_fee_sharing_authority_row::TransferFeeSharingAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpdateAdmin { data, .. } => {
let row = update_admin_row::UpdateAdminRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpdateFeeConfig { data, .. } => {
let row = update_fee_config_row::UpdateFeeConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpdateFeeShares { data, .. } => {
let row = update_fee_shares_row::UpdateFeeSharesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpsertFeeTiers { data, .. } => {
let row = upsert_fee_tiers_row::UpsertFeeTiersRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
PumpFeesInstruction::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 PumpFeesInstructionWithMetadata {
async fn upsert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
let PumpFeesInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) = self;
match decoded_instruction {
PumpFeesInstruction::ClaimSocialFeePda { data, .. } => {
let row = claim_social_fee_pda_row::ClaimSocialFeePdaRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::CreateFeeSharingConfig { data, .. } => {
let row = create_fee_sharing_config_row::CreateFeeSharingConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::CreateSocialFeePda { data, .. } => {
let row = create_social_fee_pda_row::CreateSocialFeePdaRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::GetFees { data, .. } => {
let row = get_fees_row::GetFeesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::InitializeFeeConfig { data, .. } => {
let row = initialize_fee_config_row::InitializeFeeConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::InitializeFeeProgramGlobal { data, .. } => {
let row =
initialize_fee_program_global_row::InitializeFeeProgramGlobalRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::ResetFeeSharingConfig { data, .. } => {
let row = reset_fee_sharing_config_row::ResetFeeSharingConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::RevokeFeeSharingAuthority { data, .. } => {
let row =
revoke_fee_sharing_authority_row::RevokeFeeSharingAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetAuthority { data, .. } => {
let row = set_authority_row::SetAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetClaimRateLimit { data, .. } => {
let row = set_claim_rate_limit_row::SetClaimRateLimitRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetDisableFlags { data, .. } => {
let row = set_disable_flags_row::SetDisableFlagsRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::SetSocialClaimAuthority { data, .. } => {
let row = set_social_claim_authority_row::SetSocialClaimAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::TransferFeeSharingAuthority { data, .. } => {
let row =
transfer_fee_sharing_authority_row::TransferFeeSharingAuthorityRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpdateAdmin { data, .. } => {
let row = update_admin_row::UpdateAdminRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpdateFeeConfig { data, .. } => {
let row = update_fee_config_row::UpdateFeeConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpdateFeeShares { data, .. } => {
let row = update_fee_shares_row::UpdateFeeSharesRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::UpsertFeeTiers { data, .. } => {
let row = upsert_fee_tiers_row::UpsertFeeTiersRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
PumpFeesInstruction::CpiEvent { data, .. } => {
let row = cpi_event_row::CpiEventRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
}
}
}