Vertigo decoder

Decode Vertigo instructions, accounts and events in Rust with carbon-vertigo-decoder 2.0.0. Program ID vrTGoBuy5rYSxAfV3jaRJWHH6nN9WK4NRExGxsk1bCJ.

On this page

carbon-vertigo-decoder decodes the instructions, accounts and events of the Vertigo program (vrTGoBuy5rYSxAfV3jaRJWHH6nN9WK4NRExGxsk1bCJ): 6 instructions, 1 account type, 3 events. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.

Cratecarbon-vertigo-decoder 2.0.0
Installcargo add carbon-vertigo-decoder@2.0.0
Program IDvrTGoBuy5rYSxAfV3jaRJWHH6nN9WK4NRExGxsk1bCJ (carbon_vertigo_decoder::PROGRAM_ID)
CategoryLaunchpads
Decodercarbon_vertigo_decoder::VertigoDecoder
Instruction enuminstructions::VertigoInstruction
Account enumaccounts::VertigoAccount
Event enuminstructions::CpiEvent
Featuresserde, postgres, graphql (none enabled by default)
API docsdocs.rs/carbon-vertigo-decoder/2.0.0
Sourcedecoders/vertigo-decoder

Other launchpad decoders: Boop, Meteora DBC, Moonshot, Pump.fun, Raydium Launchpad, Virtuals, Wavebreak. To decode several in one pipeline, see launchpad decoders.

The serde feature derives Serialize/Deserialize on every type, postgres adds tables and processors for Postgres, and graphql adds a schema for the GraphQL server.

Usage#

This program crawls recent Vertigo transactions from the public RPC and prints every decoded Buy instruction. Add the dependencies:

Terminal
cargo add carbon-core@2.0.0 carbon-vertigo-decoder@2.0.0 carbon-rpc-transaction-crawler-datasource@2.0.0 carbon-log-metrics@2.0.0 env_logger tokio --features tokio/full
src/main.rs
use {
    carbon_core::{
        error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_vertigo_decoder::{instructions::VertigoInstruction, VertigoDecoder, PROGRAM_ID},
    carbon_rpc_transaction_crawler_datasource::{ConnectionConfig, Filters, RpcTransactionCrawler},
    std::sync::Arc,
};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    env_logger::init();

    // Fetches the program's recent transactions over JSON-RPC, newest first.
    let datasource = RpcTransactionCrawler::new(
        "https://api.mainnet-beta.solana.com".to_string(),
        PROGRAM_ID,
        ConnectionConfig::default(),
        Filters::new(None, None, None),
        None,
    );

    Pipeline::builder()
        .datasource(datasource)
        .metrics(Arc::new(LogMetrics::new()))
        .instruction(VertigoDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

impl Processor<InstructionProcessorInputType<'_, VertigoInstruction>> for InstructionLogger {
    async fn process(
        &mut self,
        input: &InstructionProcessorInputType<'_, VertigoInstruction>,
    ) -> CarbonResult<()> {
        let signature = input.metadata.transaction_metadata.signature;
        if let VertigoInstruction::Buy { data, accounts, .. } = input.decoded_instruction {
            println!("buy {signature}: {data:?} pool={}", accounts.pool);
        }
        Ok(())
    }
}
Terminal
RUST_LOG=info cargo run

Each Buy instruction prints one line with the transaction signature and the decoded Buy data. The public endpoint rate-limits requests, so the first lines can take a while; use your own RPC URL for anything beyond a test. See stream with RPC for the crawler options.

Events published with Anchor's emit_cpi! arrive as the CpiEvent instruction. Match them with VertigoInstruction::CpiEvent { data: CpiEvent::BuyEvent(event), .. } (import instructions::CpiEvent); see Events. If CpiEvent never arrives, the program logs its events with emit! instead: decode them with decode_log_events.

Decode accounts#

The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with programSubscribe on the public WebSocket endpoint and prints every decoded Pool account as it changes. Add the datasource and the Solana RPC types it takes:

Terminal
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2
src/main.rs
use {
    carbon_core::{
        account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
        processor::Processor,
    },
    carbon_log_metrics::LogMetrics,
    carbon_vertigo_decoder::{accounts::VertigoAccount, VertigoDecoder, PROGRAM_ID},
    carbon_rpc_program_subscribe_datasource::{Filters, RpcProgramSubscribe},
    solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, UiAccountEncoding},
    std::sync::Arc,
};

#[tokio::main]
async fn main() -> CarbonResult<()> {
    env_logger::init();

    // Streams every change to an account owned by the program (programSubscribe).
    let config = RpcProgramAccountsConfig {
        account_config: RpcAccountInfoConfig {
            encoding: Some(UiAccountEncoding::Base64),
            ..Default::default()
        },
        ..Default::default()
    };
    let datasource = RpcProgramSubscribe::new(
        "wss://api.mainnet-beta.solana.com".to_string(),
        Filters::new(PROGRAM_ID, Some(config)),
    );

    Pipeline::builder()
        .datasource(datasource)
        .metrics(Arc::new(LogMetrics::new()))
        .account(VertigoDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

impl Processor<AccountProcessorInputType<'_, VertigoAccount>> for AccountLogger {
    async fn process(
        &mut self,
        input: &AccountProcessorInputType<'_, VertigoAccount>,
    ) -> CarbonResult<()> {
        let VertigoAccount::Pool(pool) = &input.decoded_account.data;
        println!("pool {}: {pool:?}", input.metadata.pubkey);
        Ok(())
    }
}
Terminal
RUST_LOG=info cargo run

Each update to a Pool account prints its address and decoded fields; the program runs until you stop it. Cargo resolves solana-client to 4.2.2, the exact version the datasource pins, so both use the same RpcProgramAccountsConfig type. To load every existing account once instead of streaming changes, see load account state.

Instructions#

Variants of VertigoInstruction. Each is VertigoInstruction::<Variant> { program_id, data, accounts }, where data and accounts are the types listed under the variant, exported from carbon_vertigo_decoder::instructions. Discriminators are the leading bytes of the instruction data, in hex.

How an instruction decodes. The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:

  1. The instruction's program ID is vrTGoBuy5rYSxAfV3jaRJWHH6nN9WK4NRExGxsk1bCJ.
  2. The data starts with the variant's discriminator, and the rest deserializes into its data type.
  3. The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).

Accounts. They are matched by position, in the order listed. An account marked optional is None only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for Some(PROGRAM_ID) too. Accounts after the listed ones are in accounts.remaining as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input.raw_instruction.accounts[i].is_signer and .is_writable, which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.

Buy#

Discriminator 66063d1201daebea · data Buy · accounts BuyInstructionAccounts.

FieldType
paramsSwapParams

Required accounts: 13; extras go to remaining.

Fields of BuyInstructionAccounts, in account order:

#FieldType
0poolPubkey
1userPubkey
2ownerPubkey
3mint_aPubkey
4mint_bPubkey
5user_ta_aPubkey
6user_ta_bPubkey
7vault_aPubkey
8vault_bPubkey
9token_program_aPubkey
10token_program_bPubkey
11system_programPubkey
12programPubkey
13…remainingVec<AccountMeta>

Claim#

Discriminator 3ec6d6c1d59f6cd2 · data Claim · accounts ClaimInstructionAccounts.

No data fields.

Required accounts: 7; extras go to remaining.

Fields of ClaimInstructionAccounts, in account order:

#FieldType
0poolPubkey
1system_programPubkey
2claimerPubkey
3mint_aPubkey
4vault_aPubkey
5receiver_ta_aPubkey
6token_program_aPubkey
7…remainingVec<AccountMeta>

Create#

Discriminator 181ec828051c0777 · data Create · accounts CreateInstructionAccounts.

FieldType
paramsCreateParams

Required accounts: 13; extras go to remaining.

Fields of CreateInstructionAccounts, in account order:

#FieldType
0payerPubkey
1ownerPubkey
2token_wallet_authorityPubkey
3mint_aPubkey
4mint_bPubkey
5token_wallet_bPubkey
6poolPubkey
7vault_aPubkey
8vault_bPubkey
9token_program_aPubkey
10token_program_bPubkey
11system_programPubkey
12rentPubkey
13…remainingVec<AccountMeta>

QuoteBuy#

Discriminator 5309e76e921f280c · data QuoteBuy · accounts QuoteBuyInstructionAccounts.

FieldType
paramsSwapParams

Required accounts: 6; extras go to remaining.

Fields of QuoteBuyInstructionAccounts, in account order:

#FieldType
0poolPubkey
1ownerPubkey
2userPubkey
3mint_aPubkey
4mint_bPubkey
5programPubkey
6…remainingVec<AccountMeta>

QuoteSell#

Discriminator 05b231ce8ce78391 · data QuoteSell · accounts QuoteSellInstructionAccounts.

FieldType
paramsSwapParams

Required accounts: 6; extras go to remaining.

Fields of QuoteSellInstructionAccounts, in account order:

#FieldType
0poolPubkey
1ownerPubkey
2userPubkey
3mint_aPubkey
4mint_bPubkey
5programPubkey
6…remainingVec<AccountMeta>

Sell#

Discriminator 33e685a4017f83ad · data Sell · accounts SellInstructionAccounts.

FieldType
paramsSwapParams

Required accounts: 13; extras go to remaining.

Fields of SellInstructionAccounts, in account order:

#FieldType
0poolPubkey
1userPubkey
2ownerPubkey
3mint_aPubkey
4mint_bPubkey
5user_ta_aPubkey
6user_ta_bPubkey
7vault_aPubkey
8vault_bPubkey
9token_program_aPubkey
10token_program_bPubkey
11system_programPubkey
12programPubkey
13…remainingVec<AccountMeta>

CpiEvent#

Anchor self-CPI that carries one of the program's events. data is the CpiEvent enum.

Discriminator e445a52e51cb9a1d · data CpiEvent · accounts CpiEventInstructionAccounts.

Required accounts: 2; extras go to remaining.

Fields of CpiEventInstructionAccounts, in account order:

#FieldType
0programPubkey
1event_authorityPubkey
2…remainingVec<AccountMeta>

Accounts#

Variants of VertigoAccount. Each wraps a boxed struct from carbon_vertigo_decoder::accounts::<module>. decode_account only considers accounts owned by PROGRAM_ID and returns the first variant that matches.

Pool#

Discriminator f19a6d0411b16dbc · accounts::pool::Pool.

FieldType
enabledbool
ownerPubkey
mint_aPubkey
mint_bPubkey
token_a_reservesu128
token_b_reservesu128
shiftu128
royaltiesu64
vertigo_feesu64
bumpu8
fee_paramsFeeParams

Events#

Variants of instructions::CpiEvent, decoded from the CpiEvent instruction. Each wraps a struct from carbon_vertigo_decoder::events::<module>. The discriminator is the 8-byte event discriminator that follows the e445a52e51cb9a1d CPI-event tag.

BuyEvent#

Discriminator 67f4521f2cf57777 · events::buy_event::BuyEventEvent.

FieldType
poolPubkey
userPubkey
amount_au64
amount_bu64
new_reserves_au128
new_reserves_bu128
fee_au64

PoolCreated#

Discriminator ca2c295868dc9d52 · events::pool_created::PoolCreatedEvent.

FieldType
poolPubkey
mint_aPubkey
mint_bPubkey
ownerPubkey
initial_token_reservesu64
shiftu128
fee_paramsFeeParams

SellEvent#

Discriminator 3e2f370aa503dc2a · events::sell_event::SellEventEvent.

FieldType
poolPubkey
userPubkey
amount_au64
amount_bu64
new_reserves_au128
new_reserves_bu128
fee_au64

Types#

Types used by the instructions, accounts and events above, exported from carbon_vertigo_decoder::types.

BuyEvent#

Struct types::BuyEvent. Same fields as the BuyEvent event.

CreateParams#

Struct types::CreateParams.

FieldType
shiftu128
initial_token_b_reservesu64
fee_paramsFeeParams

FeeParams#

Struct types::FeeParams.

FieldTypeDescription
normalization_periodu64The normalization period in slots. During this period, the fee will decay from 100% to the base fee.
decayf64Normalization period fee decay rate. Higher values decay faster.
referenceu64Reference slot for the fee calculation.
royalties_bpsu16Royalties in basis points.
privileged_swapperOption<Pubkey>Number of fee exempt buys.

PoolCreated#

Struct types::PoolCreated. Same fields as the PoolCreated event.

SellEvent#

Struct types::SellEvent. Same fields as the SellEvent event.

SwapParams#

Struct types::SwapParams.

FieldType
amountu64
limitu64

SwapResult#

Struct types::SwapResult.

FieldType
new_reserves_au128
new_reserves_bu128
amount_au64
amount_bu64
fee_au64

Generated from the crate’s source at Carbon v2.0.0, so it always matches the published code. Spotted a problem? Report it; edits to this page itself are overwritten on the next release.

Your endpoints

Code samples use these instead of the placeholders, so you can copy and run them as they are. They’re stored only in this browser and never sent anywhere.