pub mod buy_exact_in_row;
pub mod buy_exact_out_row;
pub mod claim_creator_fee_row;
pub mod claim_platform_fee_from_vault_row;
pub mod claim_platform_fee_row;
pub mod claim_vested_token_row;
pub mod close_platform_global_access_row;
pub mod collect_fee_row;
pub mod collect_migrate_fee_row;
pub mod cpi_event_row;
pub mod create_config_row;
pub mod create_platform_config_row;
pub mod create_platform_global_access_row;
pub mod create_platform_vesting_account_row;
pub mod create_vesting_account_row;
pub mod initialize_row;
pub mod initialize_v2_row;
pub mod initialize_with_token2022_row;
pub mod migrate_to_amm_row;
pub mod migrate_to_cpswap_row;
pub mod remove_platform_curve_param_row;
pub mod sell_exact_in_row;
pub mod sell_exact_out_row;
pub mod update_config_row;
pub mod update_platform_config_row;
pub mod update_platform_curve_param_row;
pub use self::{
buy_exact_in_row::*, buy_exact_out_row::*, claim_creator_fee_row::*,
claim_platform_fee_from_vault_row::*, claim_platform_fee_row::*, claim_vested_token_row::*,
close_platform_global_access_row::*, collect_fee_row::*, collect_migrate_fee_row::*,
cpi_event_row::*, create_config_row::*, create_platform_config_row::*,
create_platform_global_access_row::*, create_platform_vesting_account_row::*,
create_vesting_account_row::*, initialize_row::*, initialize_v2_row::*,
initialize_with_token2022_row::*, migrate_to_amm_row::*, migrate_to_cpswap_row::*,
remove_platform_curve_param_row::*, sell_exact_in_row::*, sell_exact_out_row::*,
update_config_row::*, update_platform_config_row::*, update_platform_curve_param_row::*,
};
use super::RaydiumLaunchpadInstruction;
pub struct RaydiumLaunchpadInstructionsMigration;
impl sqlx_migrator::Migration<sqlx::Postgres> for RaydiumLaunchpadInstructionsMigration {
fn app(&self) -> &str {
"raydium-launchpad"
}
fn name(&self) -> &str {
"raydium_launchpad_instructions"
}
fn operations(&self) -> Vec<Box<dyn sqlx_migrator::Operation<sqlx::Postgres>>> {
vec![
Box::new(BuyExactInMigrationOperation),
Box::new(BuyExactOutMigrationOperation),
Box::new(ClaimCreatorFeeMigrationOperation),
Box::new(ClaimPlatformFeeMigrationOperation),
Box::new(ClaimPlatformFeeFromVaultMigrationOperation),
Box::new(ClaimVestedTokenMigrationOperation),
Box::new(ClosePlatformGlobalAccessMigrationOperation),
Box::new(CollectFeeMigrationOperation),
Box::new(CollectMigrateFeeMigrationOperation),
Box::new(CreateConfigMigrationOperation),
Box::new(CreatePlatformConfigMigrationOperation),
Box::new(CreatePlatformGlobalAccessMigrationOperation),
Box::new(CreatePlatformVestingAccountMigrationOperation),
Box::new(CreateVestingAccountMigrationOperation),
Box::new(InitializeMigrationOperation),
Box::new(InitializeV2MigrationOperation),
Box::new(InitializeWithToken2022MigrationOperation),
Box::new(MigrateToAmmMigrationOperation),
Box::new(MigrateToCpswapMigrationOperation),
Box::new(RemovePlatformCurveParamMigrationOperation),
Box::new(SellExactInMigrationOperation),
Box::new(SellExactOutMigrationOperation),
Box::new(UpdateConfigMigrationOperation),
Box::new(UpdatePlatformConfigMigrationOperation),
Box::new(UpdatePlatformCurveParamMigrationOperation),
Box::new(CpiEventMigrationOperation),
]
}
fn parents(&self) -> Vec<Box<dyn sqlx_migrator::Migration<sqlx::Postgres>>> {
vec![]
}
}
pub struct RaydiumLaunchpadInstructionWithMetadata(
pub RaydiumLaunchpadInstruction,
pub carbon_core::instruction::InstructionMetadata,
pub Vec<solana_instruction::AccountMeta>,
);
impl
From<(
RaydiumLaunchpadInstruction,
carbon_core::instruction::InstructionMetadata,
Vec<solana_instruction::AccountMeta>,
)> for RaydiumLaunchpadInstructionWithMetadata
{
fn from(
value: (
RaydiumLaunchpadInstruction,
carbon_core::instruction::InstructionMetadata,
Vec<solana_instruction::AccountMeta>,
),
) -> Self {
RaydiumLaunchpadInstructionWithMetadata(value.0, value.1, value.2)
}
}
#[async_trait::async_trait]
impl carbon_core::postgres::operations::Insert for RaydiumLaunchpadInstructionWithMetadata {
async fn insert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
let RaydiumLaunchpadInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) =
self;
match decoded_instruction {
RaydiumLaunchpadInstruction::BuyExactIn { data, .. } => {
let row = buy_exact_in_row::BuyExactInRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::BuyExactOut { data, .. } => {
let row = buy_exact_out_row::BuyExactOutRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimCreatorFee { data, .. } => {
let row = claim_creator_fee_row::ClaimCreatorFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimPlatformFee { data, .. } => {
let row = claim_platform_fee_row::ClaimPlatformFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimPlatformFeeFromVault { data, .. } => {
let row =
claim_platform_fee_from_vault_row::ClaimPlatformFeeFromVaultRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimVestedToken { data, .. } => {
let row = claim_vested_token_row::ClaimVestedTokenRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClosePlatformGlobalAccess { data, .. } => {
let row =
close_platform_global_access_row::ClosePlatformGlobalAccessRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CollectFee { data, .. } => {
let row = collect_fee_row::CollectFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CollectMigrateFee { data, .. } => {
let row = collect_migrate_fee_row::CollectMigrateFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreateConfig { data, .. } => {
let row = create_config_row::CreateConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreatePlatformConfig { data, .. } => {
let row = create_platform_config_row::CreatePlatformConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreatePlatformGlobalAccess { data, .. } => {
let row =
create_platform_global_access_row::CreatePlatformGlobalAccessRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreatePlatformVestingAccount { data, .. } => {
let row = create_platform_vesting_account_row::CreatePlatformVestingAccountRow::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreateVestingAccount { data, .. } => {
let row = create_vesting_account_row::CreateVestingAccountRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::Initialize { data, .. } => {
let row = initialize_row::InitializeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::InitializeV2 { data, .. } => {
let row = initialize_v2_row::InitializeV2Row::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::InitializeWithToken2022 { data, .. } => {
let row = initialize_with_token2022_row::InitializeWithToken2022Row::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::MigrateToAmm { data, .. } => {
let row = migrate_to_amm_row::MigrateToAmmRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::MigrateToCpswap { data, .. } => {
let row = migrate_to_cpswap_row::MigrateToCpswapRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::RemovePlatformCurveParam { data, .. } => {
let row = remove_platform_curve_param_row::RemovePlatformCurveParamRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::SellExactIn { data, .. } => {
let row = sell_exact_in_row::SellExactInRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::SellExactOut { data, .. } => {
let row = sell_exact_out_row::SellExactOutRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::UpdateConfig { data, .. } => {
let row = update_config_row::UpdateConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::UpdatePlatformConfig { data, .. } => {
let row = update_platform_config_row::UpdatePlatformConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::UpdatePlatformCurveParam { data, .. } => {
let row = update_platform_curve_param_row::UpdatePlatformCurveParamRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.insert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::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 RaydiumLaunchpadInstructionWithMetadata {
async fn upsert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
let RaydiumLaunchpadInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) =
self;
match decoded_instruction {
RaydiumLaunchpadInstruction::BuyExactIn { data, .. } => {
let row = buy_exact_in_row::BuyExactInRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::BuyExactOut { data, .. } => {
let row = buy_exact_out_row::BuyExactOutRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimCreatorFee { data, .. } => {
let row = claim_creator_fee_row::ClaimCreatorFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimPlatformFee { data, .. } => {
let row = claim_platform_fee_row::ClaimPlatformFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimPlatformFeeFromVault { data, .. } => {
let row =
claim_platform_fee_from_vault_row::ClaimPlatformFeeFromVaultRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClaimVestedToken { data, .. } => {
let row = claim_vested_token_row::ClaimVestedTokenRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::ClosePlatformGlobalAccess { data, .. } => {
let row =
close_platform_global_access_row::ClosePlatformGlobalAccessRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CollectFee { data, .. } => {
let row = collect_fee_row::CollectFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CollectMigrateFee { data, .. } => {
let row = collect_migrate_fee_row::CollectMigrateFeeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreateConfig { data, .. } => {
let row = create_config_row::CreateConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreatePlatformConfig { data, .. } => {
let row = create_platform_config_row::CreatePlatformConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreatePlatformGlobalAccess { data, .. } => {
let row =
create_platform_global_access_row::CreatePlatformGlobalAccessRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreatePlatformVestingAccount { data, .. } => {
let row = create_platform_vesting_account_row::CreatePlatformVestingAccountRow::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CreateVestingAccount { data, .. } => {
let row = create_vesting_account_row::CreateVestingAccountRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::Initialize { data, .. } => {
let row = initialize_row::InitializeRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::InitializeV2 { data, .. } => {
let row = initialize_v2_row::InitializeV2Row::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::InitializeWithToken2022 { data, .. } => {
let row = initialize_with_token2022_row::InitializeWithToken2022Row::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::MigrateToAmm { data, .. } => {
let row = migrate_to_amm_row::MigrateToAmmRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::MigrateToCpswap { data, .. } => {
let row = migrate_to_cpswap_row::MigrateToCpswapRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::RemovePlatformCurveParam { data, .. } => {
let row = remove_platform_curve_param_row::RemovePlatformCurveParamRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::SellExactIn { data, .. } => {
let row = sell_exact_in_row::SellExactInRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::SellExactOut { data, .. } => {
let row = sell_exact_out_row::SellExactOutRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::UpdateConfig { data, .. } => {
let row = update_config_row::UpdateConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::UpdatePlatformConfig { data, .. } => {
let row = update_platform_config_row::UpdatePlatformConfigRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::UpdatePlatformCurveParam { data, .. } => {
let row = update_platform_curve_param_row::UpdatePlatformCurveParamRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
RaydiumLaunchpadInstruction::CpiEvent { data, .. } => {
let row = cpi_event_row::CpiEventRow::from_parts(
data.clone(),
metadata.clone(),
raw_accounts.clone(),
);
row.upsert(pool).await?;
Ok(())
}
}
}
}