Sharky decoder

Decode Sharky instructions and accounts in Rust with carbon-sharky-decoder 2.0.0. Program ID SHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP.

On this page

carbon-sharky-decoder decodes the instructions and accounts of the Sharky program (SHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP): 35 instructions, 9 account types. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.

Cratecarbon-sharky-decoder 2.0.0
Installcargo add carbon-sharky-decoder@2.0.0
Program IDSHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP (carbon_sharky_decoder::PROGRAM_ID)
CategoryLending
Decodercarbon_sharky_decoder::SharkyDecoder
Instruction enuminstructions::SharkyInstruction
Account enumaccounts::SharkyAccount
Featuresserde, postgres, graphql (none enabled by default)
API docsdocs.rs/carbon-sharky-decoder/2.0.0
Sourcedecoders/sharky-decoder

Other lending decoders: Jupiter Lend, Kamino Lending, Kamino Vault, marginfi v2, Meteora Vault. To decode several in one pipeline, see lending 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 Sharky transactions from the public RPC and prints every decoded AddLiquidityTokenPool instruction. Add the dependencies:

Terminal
cargo add carbon-core@2.0.0 carbon-sharky-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_sharky_decoder::{instructions::SharkyInstruction, SharkyDecoder, 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(SharkyDecoder, InstructionLogger)
        .build()?
        .run()
        .await
}

struct InstructionLogger;

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

Each AddLiquidityTokenPool instruction prints one line with the transaction signature and the decoded AddLiquidityTokenPool 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.

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 EscrowPDA 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_sharky_decoder::{accounts::SharkyAccount, SharkyDecoder, 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(SharkyDecoder, AccountLogger)
        .build()?
        .run()
        .await
}

struct AccountLogger;

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

Each update to a EscrowPDA 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 SharkyInstruction. Each is SharkyInstruction::<Variant> { program_id, data, accounts }, where data and accounts are the types listed under the variant, exported from carbon_sharky_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 SHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP.
  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.

AddLiquidityTokenPool#

Discriminator e7ca2b0a7bc476ac · data AddLiquidityTokenPool · accounts AddLiquidityTokenPoolInstructionAccounts.

FieldType
usdc_amountu64

Required accounts: 7; extras go to remaining.

Fields of AddLiquidityTokenPoolInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1poolPubkey
2usdc_vaultPubkey
3lenderPubkey
4lender_usdcPubkey
5loan_mintPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

CloseEscrowValueMintAtaAdmin#

Discriminator 04860129a8f8dd1c · data CloseEscrowValueMintAtaAdmin · accounts CloseEscrowValueMintAtaAdminInstructionAccounts.

FieldType
escrow_bumpu8

Required accounts: 8; extras go to remaining.

Fields of CloseEscrowValueMintAtaAdminInstructionAccounts, in account order:

#FieldType
0loanPubkey
1lenderPubkey
2escrowPubkey
3escrow_value_mint_token_accountPubkey
4adminPubkey
5system_programPubkey
6token_programPubkey
7associated_token_programPubkey
8…remainingVec<AccountMeta>

CloseNftList#

Discriminator 23087952da4efca2 · data CloseNftList · accounts CloseNftListInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of CloseNftListInstructionAccounts, in account order:

#FieldType
0nft_listPubkey
1payerPubkey
2…remainingVec<AccountMeta>

CloseOrderBook#

From the program's IDL:

Closes an order book, must be signed by sharky key

Discriminator db8649dbb4075ece · data CloseOrderBook · accounts CloseOrderBookInstructionAccounts.

No data fields.

Required accounts: 2; extras go to remaining.

Fields of CloseOrderBookInstructionAccounts, in account order:

#FieldType
0order_bookPubkey
1payerPubkey
2…remainingVec<AccountMeta>

CloseTokenOrderbook#

Discriminator e304e16dcfeb476a · data CloseTokenOrderbook · accounts CloseTokenOrderbookInstructionAccounts.

No data fields.

Required accounts: 3; extras go to remaining.

Fields of CloseTokenOrderbookInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1authorityPubkey
2system_programPubkey
3…remainingVec<AccountMeta>

CloseTokenPool#

Discriminator 02fb3604f2c8ae8f · data CloseTokenPool · accounts CloseTokenPoolInstructionAccounts.

No data fields.

Required accounts: 10; extras go to remaining.

Fields of CloseTokenPoolInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1poolPubkey
2usdc_vaultPubkey
3collateral_vaultPubkey
4lenderPubkey
5lender_usdcPubkey
6lender_collateralPubkey
7loan_mintPubkey
8collateral_mintPubkey
9token_programPubkey
10…remainingVec<AccountMeta>

CreateNftList#

Discriminator f326c64cac407f18 · data CreateNftList · accounts CreateNftListInstructionAccounts.

FieldType
collection_nameString

Required accounts: 2; extras go to remaining.

Fields of CreateNftListInstructionAccounts, in account order:

#FieldType
0nft_listPubkey
1payerPubkey
2…remainingVec<AccountMeta>

CreateOrderBook#

From the program's IDL:

Creates an order book, must be signed by sharky key

Discriminator 997209336444f0c5 · data CreateOrderBook · accounts CreateOrderBookInstructionAccounts.

FieldType
order_book_typeOrderBookType
apyAPY
loan_termsBookLoanTerms
fee_permillicentageu16
fee_authorityPubkey

Required accounts: 3; extras go to remaining.

Fields of CreateOrderBookInstructionAccounts, in account order:

#FieldType
0order_bookPubkey
1payerPubkey
2system_programPubkey
3…remainingVec<AccountMeta>

CreateProgramVersion#

Discriminator 67d800ee5c6bdb79 · data CreateProgramVersion · accounts CreateProgramVersionInstructionAccounts.

FieldType
versionu8

Required accounts: 4; extras go to remaining.

Fields of CreateProgramVersionInstructionAccounts, in account order:

#FieldType
0authorityPubkey
1program_versionPubkey
2system_programPubkey
3rentPubkey
4…remainingVec<AccountMeta>

CreateTokenOrderbook#

Discriminator 88965e5dd4a2ded6 · data CreateTokenOrderbook · accounts CreateTokenOrderbookInstructionAccounts.

FieldType
durationu64
apru32
fee_permillicentageu16
fee_authorityPubkey
min_liquidityOption<u64>
max_liquidityOption<u64>

Required accounts: 5; extras go to remaining.

Fields of CreateTokenOrderbookInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1loan_mintPubkey
2collateral_mintPubkey
3authorityPubkey
4system_programPubkey
5…remainingVec<AccountMeta>

CreateTokenPool#

Discriminator 17a91b7a93a9d198 · data CreateTokenPool · accounts CreateTokenPoolInstructionAccounts.

FieldType
nonceu64
initial_usdc_liquidityu64
required_collateral_amountu64

Required accounts: 10; extras go to remaining.

Fields of CreateTokenPoolInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1poolPubkey
2usdc_vaultPubkey
3collateral_vaultPubkey
4lenderPubkey
5lender_usdc_ataPubkey
6loan_mintPubkey
7collateral_mintPubkey
8token_programPubkey
9system_programPubkey
10…remainingVec<AccountMeta>

ExtendLoanCore#

From the program's IDL:

Extend a loan with a new loan (core)

Discriminator 8de35be5c626964f · data ExtendLoanCore · accounts ExtendLoanCoreInstructionAccounts.

FieldType
expected_loanString

Required accounts: 16; extras go to remaining.

Fields of ExtendLoanCoreInstructionAccounts, in account order:

#FieldType
0loanPubkey
1new_loanPubkey
2borrowerPubkey
3lenderPubkey
4new_lenderPubkey
5escrowPubkey
6new_escrowPubkey
7value_mintPubkey
8collateral_mintPubkey
9collectionOption<Pubkey>
10order_bookPubkey
11fee_authorityPubkey
12system_programPubkey
13rentPubkey
14log_wrapperOption<Pubkey>
15mpl_core_programPubkey
16…remainingVec<AccountMeta>

ExtendLoanV3#

Discriminator 471b11834e493e5c · data ExtendLoanV3 · accounts ExtendLoanV3InstructionAccounts.

FieldType
expected_loanString

Required accounts: 21; extras go to remaining.

Fields of ExtendLoanV3InstructionAccounts, in account order:

#FieldType
0loanPubkey
1new_loanPubkey
2borrowerPubkey
3borrower_collateral_token_accountPubkey
4lenderPubkey
5new_lenderPubkey
6escrowPubkey
7escrow_collateral_token_accountPubkey
8new_escrowPubkey
9new_escrow_collateral_token_accountPubkey
10value_mintPubkey
11collateral_mintPubkey
12order_bookPubkey
13fee_authorityPubkey
14metadataPubkey
15editionPubkey
16system_programPubkey
17token_programPubkey
18associated_token_programPubkey
19rentPubkey
20mpl_token_metadata_programPubkey
21…remainingVec<AccountMeta>

ExtendLoanV3Compressed#

From the program's IDL:

Extend a loan with a new loan (cNFT)

Discriminator 94a14b578a22833e · data ExtendLoanV3Compressed · accounts ExtendLoanV3CompressedInstructionAccounts.

FieldType
expected_loanString
cnft_root[u8; 32]
cnft_data_hash[u8; 32]
cnft_creator_hash[u8; 32]
cnft_nonceu64
cnft_indexu32

Required accounts: 18; extras go to remaining.

Fields of ExtendLoanV3CompressedInstructionAccounts, in account order:

#FieldType
0loanPubkey
1new_loanPubkey
2borrowerPubkey
3lenderPubkey
4new_lenderPubkey
5escrowPubkey
6new_escrowPubkey
7value_mintPubkey
8order_bookPubkey
9fee_authorityPubkey
10tree_authorityPubkey
11log_wrapperPubkey
12merkle_treePubkey
13system_programPubkey
14token_programPubkey
15mpl_bubblegum_programPubkey
16compression_programPubkey
17rentPubkey
18…remainingVec<AccountMeta>

ExtendTokenLoan#

Discriminator 39213d664656a482 · data ExtendTokenLoan · accounts ExtendTokenLoanInstructionAccounts.

FieldType
new_usdc_amountu64
expected_new_loanString

Required accounts: 20; extras go to remaining.

Fields of ExtendTokenLoanInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1old_loanPubkey
2new_loanPubkey
3old_poolPubkey
4new_poolPubkey
5old_lender_usdcPubkey
6old_collateral_vaultPubkey
7new_usdc_vaultPubkey
8new_collateral_vaultPubkey
9borrowerPubkey
10borrower_usdcPubkey
11borrower_collateralPubkey
12loan_mintPubkey
13collateral_mintPubkey
14fee_authorityPubkey
15burn_walletPubkey
16price_updatePubkey
17token_programPubkey
18associated_token_programPubkey
19system_programPubkey
20…remainingVec<AccountMeta>

ForecloseLoanCore#

From the program's IDL:

Forecloses on a taken lone that has met some condition (core)

Discriminator cf235493770ec385 · data ForecloseLoanCore · accounts ForecloseLoanCoreInstructionAccounts.

No data fields.

Required accounts: 10; extras go to remaining.

Fields of ForecloseLoanCoreInstructionAccounts, in account order:

#FieldType
0loanPubkey
1escrowPubkey
2collateral_mintPubkey
3collectionOption<Pubkey>
4borrowerPubkey
5lenderPubkey
6system_programPubkey
7rentPubkey
8log_wrapperOption<Pubkey>
9mpl_core_programPubkey
10…remainingVec<AccountMeta>

ForecloseLoanV3#

From the program's IDL:

Forecloses on a taken lone that has met some condition

Discriminator 88b8323ab75c3fd8 · data ForecloseLoanV3 · accounts ForecloseLoanV3InstructionAccounts.

No data fields.

Required accounts: 15; extras go to remaining.

Fields of ForecloseLoanV3InstructionAccounts, in account order:

#FieldType
0loanPubkey
1escrowPubkey
2escrow_collateral_token_accountPubkey
3collateral_mintPubkey
4borrowerPubkey
5lenderPubkey
6lender_collateral_token_accountPubkey
7borrower_collateral_token_accountPubkey
8metadataPubkey
9editionPubkey
10system_programPubkey
11token_programPubkey
12associated_token_programPubkey
13rentPubkey
14mpl_token_metadata_programPubkey
15…remainingVec<AccountMeta>

ForecloseLoanV3Compressed#

From the program's IDL:

Forecloses on a taken lone that has met some condition (cNFT)

Discriminator c2c105c17385e7c5 · data ForecloseLoanV3Compressed · accounts ForecloseLoanV3CompressedInstructionAccounts.

FieldType
cnft_root[u8; 32]
cnft_data_hash[u8; 32]
cnft_creator_hash[u8; 32]
cnft_nonceu64
cnft_indexu32

Required accounts: 12; extras go to remaining.

Fields of ForecloseLoanV3CompressedInstructionAccounts, in account order:

#FieldType
0loanPubkey
1escrowPubkey
2borrowerPubkey
3lenderPubkey
4tree_authorityPubkey
5log_wrapperPubkey
6merkle_treePubkey
7system_programPubkey
8token_programPubkey
9mpl_bubblegum_programPubkey
10compression_programPubkey
11rentPubkey
12…remainingVec<AccountMeta>

ForecloseTokenLoan#

Discriminator c538e1490be8211e · data ForecloseTokenLoan · accounts ForecloseTokenLoanInstructionAccounts.

No data fields.

Required accounts: 10; extras go to remaining.

Fields of ForecloseTokenLoanInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1loanPubkey
2borrowerPubkey
3poolPubkey
4lenderPubkey
5lender_collateral_ataPubkey
6collateral_vaultPubkey
7loan_mintPubkey
8collateral_mintPubkey
9token_programPubkey
10…remainingVec<AccountMeta>

OfferLoan#

From the program's IDL:

Offers a loan for a given order book

Discriminator 2c0c4c90d2d0ef55 · data OfferLoan · accounts OfferLoanInstructionAccounts.

FieldType
escrow_bumpu8
principal_lamportsu64
terms_choiceOption<LoanTermsSpec>

Required accounts: 11; extras go to remaining.

Fields of OfferLoanInstructionAccounts, in account order:

#FieldType
0lenderPubkey
1lender_value_token_accountPubkey
2value_mintPubkey
3loanPubkey
4escrowPubkey
5escrow_token_accountPubkey
6order_bookPubkey
7system_programPubkey
8token_programPubkey
9associated_token_programPubkey
10rentPubkey
11…remainingVec<AccountMeta>

RepayLoanCore#

From the program's IDL:

Repays a given loan in exchange for the NFT (core)

Discriminator f084bad66543d78c · data RepayLoanCore · accounts RepayLoanCoreInstructionAccounts.

No data fields.

Required accounts: 13; extras go to remaining.

Fields of RepayLoanCoreInstructionAccounts, in account order:

#FieldType
0loanPubkey
1borrowerPubkey
2lenderPubkey
3escrowPubkey
4value_mintPubkey
5collateral_mintPubkey
6collectionOption<Pubkey>
7order_bookPubkey
8fee_authorityPubkey
9system_programPubkey
10rentPubkey
11log_wrapperOption<Pubkey>
12mpl_core_programPubkey
13…remainingVec<AccountMeta>

RepayLoanV3#

From the program's IDL:

Repays a given loan in exchange for the NFT

Discriminator 617b55364c103d9d · data RepayLoanV3 · accounts RepayLoanV3InstructionAccounts.

No data fields.

Required accounts: 17; extras go to remaining.

Fields of RepayLoanV3InstructionAccounts, in account order:

#FieldType
0loanPubkey
1borrowerPubkey
2borrower_collateral_token_accountPubkey
3lenderPubkey
4escrowPubkey
5escrow_collateral_token_accountPubkey
6value_mintPubkey
7collateral_mintPubkey
8order_bookPubkey
9fee_authorityPubkey
10metadataPubkey
11editionPubkey
12system_programPubkey
13token_programPubkey
14associated_token_programPubkey
15rentPubkey
16mpl_token_metadata_programPubkey
17…remainingVec<AccountMeta>

RepayLoanV3Compressed#

From the program's IDL:

Repays a given loan in exchange for the NFT (cNFT)

Discriminator 9f9ff5a8bf9a6406 · data RepayLoanV3Compressed · accounts RepayLoanV3CompressedInstructionAccounts.

FieldType
cnft_root[u8; 32]
cnft_data_hash[u8; 32]
cnft_creator_hash[u8; 32]
cnft_nonceu64
cnft_indexu32

Required accounts: 15; extras go to remaining.

Fields of RepayLoanV3CompressedInstructionAccounts, in account order:

#FieldType
0loanPubkey
1borrowerPubkey
2lenderPubkey
3escrowPubkey
4value_mintPubkey
5order_bookPubkey
6fee_authorityPubkey
7tree_authorityPubkey
8log_wrapperPubkey
9merkle_treePubkey
10system_programPubkey
11token_programPubkey
12mpl_bubblegum_programPubkey
13compression_programPubkey
14rentPubkey
15…remainingVec<AccountMeta>

RepayTokenLoan#

Discriminator d032d027bd9919fb · data RepayTokenLoan · accounts RepayTokenLoanInstructionAccounts.

No data fields.

Required accounts: 13; extras go to remaining.

Fields of RepayTokenLoanInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1loanPubkey
2poolPubkey
3lender_usdcPubkey
4collateral_vaultPubkey
5borrowerPubkey
6borrower_usdcPubkey
7borrower_collateralPubkey
8loan_mintPubkey
9collateral_mintPubkey
10token_programPubkey
11associated_token_programPubkey
12system_programPubkey
13…remainingVec<AccountMeta>

RescindLoan#

From the program's IDL:

Removes an offered but not taken loan

Discriminator 4040a0d33324b19e · data RescindLoan · accounts RescindLoanInstructionAccounts.

No data fields.

Required accounts: 8; extras go to remaining.

Fields of RescindLoanInstructionAccounts, in account order:

#FieldType
0loanPubkey
1lender_value_token_accountOption<Pubkey>
2lenderPubkey
3value_mintPubkey
4escrowPubkey
5escrow_token_accountPubkey
6system_programPubkey
7token_programPubkey
8…remainingVec<AccountMeta>

TakeLoanCore#

From the program's IDL:

Takes an offered loan in exchange for a valid NFT (core)

Discriminator b26fec3c9f6ceafe · data TakeLoanCore · accounts TakeLoanCoreInstructionAccounts.

FieldType
expected_loanString
nft_list_indexOption<u32>

Required accounts: 11; extras go to remaining.

Fields of TakeLoanCoreInstructionAccounts, in account order:

#FieldType
0lenderPubkey
1borrowerPubkey
2collateral_mintPubkey
3collectionOption<Pubkey>
4loanPubkey
5escrowPubkey
6order_bookPubkey
7system_programPubkey
8rentPubkey
9log_wrapperOption<Pubkey>
10mpl_core_programPubkey
11…remainingVec<AccountMeta>

TakeLoanV3#

From the program's IDL:

Takes an offered loan in exchange for a valid NFT (migration off cardinal)

Discriminator ff73dc3a1a9d70b9 · data TakeLoanV3 · accounts TakeLoanV3InstructionAccounts.

FieldType
expected_loanString
nft_list_indexOption<u32>
skip_freezing_collateralbool

Required accounts: 15; extras go to remaining.

Fields of TakeLoanV3InstructionAccounts, in account order:

#FieldType
0lenderPubkey
1borrowerPubkey
2borrower_collateral_token_accountPubkey
3collateral_mintPubkey
4loanPubkey
5escrowPubkey
6escrow_collateral_token_accountPubkey
7order_bookPubkey
8metadataPubkey
9editionPubkey
10system_programPubkey
11token_programPubkey
12associated_token_programPubkey
13rentPubkey
14mpl_token_metadata_programPubkey
15…remainingVec<AccountMeta>

TakeLoanV3Compressed#

From the program's IDL:

Takes an offered loan in exchange for a valid NFT (cNFT)

Discriminator f1726a4f1059e97d · data TakeLoanV3Compressed · accounts TakeLoanV3CompressedInstructionAccounts.

FieldType
expected_loanString
nft_list_indexOption<u32>
cnft_argsCnftArgs

Required accounts: 14; extras go to remaining.

Fields of TakeLoanV3CompressedInstructionAccounts, in account order:

#FieldType
0lenderPubkey
1borrowerPubkey
2loanPubkey
3escrowPubkey
4order_bookPubkey
5collateral_mintPubkey
6tree_authorityPubkey
7log_wrapperPubkey
8merkle_treePubkey
9system_programPubkey
10token_programPubkey
11mpl_bubblegum_programPubkey
12compression_programPubkey
13rentPubkey
14…remainingVec<AccountMeta>

TakeTokenLoan#

Discriminator ddd87f0a6bbd986f · data TakeTokenLoan · accounts TakeTokenLoanInstructionAccounts.

FieldType
usdc_amountu64
expected_loanString

Required accounts: 15; extras go to remaining.

Fields of TakeTokenLoanInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1loanPubkey
2poolPubkey
3usdc_vaultPubkey
4collateral_vaultPubkey
5borrowerPubkey
6borrower_usdcPubkey
7borrower_collateralPubkey
8fee_authorityPubkey
9burn_walletPubkey
10price_updatePubkey
11loan_mintPubkey
12collateral_mintPubkey
13token_programPubkey
14system_programPubkey
15…remainingVec<AccountMeta>

UpdateNftList#

Discriminator d70d19bb0b5d228f · data UpdateNftList · accounts UpdateNftListInstructionAccounts.

FieldType
mintsVec<UpdateIndex>

Required accounts: 2; extras go to remaining.

Fields of UpdateNftListInstructionAccounts, in account order:

#FieldType
0nft_listPubkey
1payerPubkey
2…remainingVec<AccountMeta>

UpdateOrderBook#

From the program's IDL:

Updates an order book, must be signed by sharky key

Discriminator 1f489fe8dc995a6d · data UpdateOrderBook · accounts UpdateOrderBookInstructionAccounts.

FieldType
order_book_typeOption<OrderBookType>
apyOption<APY>
loan_termsOption<BookLoanTerms>
fee_permillicentageOption<u16>
fee_authorityOption<Pubkey>

Required accounts: 2; extras go to remaining.

Fields of UpdateOrderBookInstructionAccounts, in account order:

#FieldType
0order_bookPubkey
1payerPubkey
2…remainingVec<AccountMeta>

UpdateProgramVersion#

Discriminator eb84d7e1d52b2b26 · data UpdateProgramVersion · accounts UpdateProgramVersionInstructionAccounts.

FieldType
versionu8

Required accounts: 2; extras go to remaining.

Fields of UpdateProgramVersionInstructionAccounts, in account order:

#FieldType
0authorityPubkey
1program_versionPubkey
2…remainingVec<AccountMeta>

UpdateTokenOrderbook#

Discriminator 13f883459602298f · data UpdateTokenOrderbook · accounts UpdateTokenOrderbookInstructionAccounts.

FieldType
durationOption<u64>
aprOption<u32>
fee_permillicentageOption<u16>
fee_authorityOption<Pubkey>
min_liquidityOption<u64>
max_liquidityOption<u64>

Required accounts: 3; extras go to remaining.

Fields of UpdateTokenOrderbookInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1authorityPubkey
2system_programPubkey
3…remainingVec<AccountMeta>

UpdateTokenPool#

Discriminator e11cb50ddc401f66 · data UpdateTokenPool · accounts UpdateTokenPoolInstructionAccounts.

FieldType
new_required_collateral_amountu64

Required accounts: 3; extras go to remaining.

Fields of UpdateTokenPoolInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1poolPubkey
2lenderPubkey
3…remainingVec<AccountMeta>

WithdrawLiquidityTokenPool#

Discriminator 3767142327b7b440 · data WithdrawLiquidityTokenPool · accounts WithdrawLiquidityTokenPoolInstructionAccounts.

No data fields.

Required accounts: 7; extras go to remaining.

Fields of WithdrawLiquidityTokenPoolInstructionAccounts, in account order:

#FieldType
0orderbookPubkey
1poolPubkey
2usdc_vaultPubkey
3lenderPubkey
4lender_usdcPubkey
5loan_mintPubkey
6token_programPubkey
7…remainingVec<AccountMeta>

Accounts#

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

EscrowPDA#

Discriminator 6d7589b5403041eb · accounts::escrow_p_d_a::EscrowPDA.

FieldType
bumpu8

Loan#

Discriminator 14c34675a5e3b601 · accounts::loan::Loan.

FieldTypeDescription
versionu8
principal_lamportsu64amount in tokens, decimals included
order_bookPubkey
value_token_mintPubkeyToken mint for what the loan is in (spl address)
escrow_bump_seedu8
loan_stateLoanStatestores start and duration

NFTList#

Discriminator 2ef468e29823aaef · accounts::n_f_t_list::NFTList.

FieldType
versionu8
collection_nameString

OrderBook#

Discriminator 37e67dda952741f8 · accounts::order_book::OrderBook.

FieldType
versionu8
order_book_typeOrderBookType
apyAPY
loan_termsBookLoanTerms
fee_permillicentageu16
fee_authorityPubkey

PriceUpdateV2#

Discriminator 22f123639d7ef4cd · accounts::price_update_v2::PriceUpdateV2.

FieldType
write_authorityPubkey
verification_levelVerificationLevel
price_messagePriceFeedMessage
posted_slotu64

ProgramVersion#

Discriminator 8a68f4c5ce2f9f9a · accounts::program_version::ProgramVersion.

FieldType
versionu8
bumpu8
updatedi64

TokenLendingLoan#

Discriminator 30fa85552a0b2d9a · accounts::token_lending_loan::TokenLendingLoan.

FieldType
orderbookPubkey
borrowerPubkey
poolPubkey
principal_usdc_amountu64
collateral_required_amountu64
start_tsi64
end_tsi64
apru32
versionu8
padding[u8; 3]

TokenLendingOrderBook#

Discriminator c0475ca36355271b · accounts::token_lending_order_book::TokenLendingOrderBook.

FieldType
fee_authorityPubkey
loan_mintPubkey
collateral_mintPubkey
collateral_token_programPubkey
durationu64
min_liquidityu64
max_liquidityu64
apru32
fee_permillicentageu16
collateral_decimalsu8
versionu8
bumpu8
padding[u8; 7]

TokenLendingPool#

Discriminator 213b0d8799697f92 · accounts::token_lending_pool::TokenLendingPool.

FieldType
orderbookPubkey
lenderPubkey
usdc_vaultPubkey
collateral_vaultPubkey
nonceu64
total_usdc_liquidityu64
available_usdc_liquidityu64
collateral_required_amountu64
total_usdc_interestu64
total_loan_countu64
active_loan_countu64
total_defaulted_loan_countu64
total_defaulted_usdc_amountu64
total_defaulted_collateral_amountu64
versionu8
bumpu8
padding[u8; 6]

Types#

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

APY#

From the program's IDL:

APY settings on an [OrderBook]

Enum types::APY.

VariantFields
Fixedapy: u32

Fixed fields:

FieldTypeDescription
apyu32Thousandths of a percent

BookLoanTerms#

Enum types::BookLoanTerms.

VariantFields
Fixedterms: LoanTermsSpec
LenderChooses

CnftArgs#

Struct types::CnftArgs.

FieldType
cnft_root[u8; 32]
cnft_data_hash[u8; 32]
cnft_creator_hash[u8; 32]
cnft_nonceu64
cnft_indexu32

LoanOffer#

Struct types::LoanOffer.

FieldType
lender_walletPubkey
terms_specLoanTermsSpec
offer_timei64

LoanState#

Enum types::LoanState.

VariantFields
Offeroffer: LoanOffer
Takentaken: TakenLoan

LoanTerms#

Enum types::LoanTerms.

VariantFields
Timestart: i64, duration: u64, total_owed_lamports: u64

Time fields:

FieldTypeDescription
starti64This is a [UnixTimeStamp]
durationu64
total_owed_lamportsu64

LoanTermsSpec#

Enum types::LoanTermsSpec.

VariantFields
Timeduration: u64

OrderBookType#

Enum types::OrderBookType.

VariantFields
Collectioncollection_key: Pubkey
NFTListlist_account: Pubkey

PriceFeedMessage#

Struct types::PriceFeedMessage.

FieldTypeDescription
feed_id[u8; 32]FeedId but avoid the type alias because of compatibility issues with Anchor's idl-build feature.
pricei64
confu64
exponenti32
publish_timei64The timestamp of this price update in seconds
prev_publish_timei64The timestamp of the previous price update. This field is intended to allow users to identify the single unique price update for any moment in time: for any time t, the unique update is the one such that prev_publish_time < t <= publish_time. Note that there may not be such an update while we are migrating to the new message-sending logic, as some price updates on pythnet may not be sent to other chains (because the message-sending logic may not have triggered). We can solve this problem by making the message-sending mandatory (which we can do once publishers have migrated over). Additionally, this field may be equal to publish_time if the message is sent on a slot where where the aggregation was unsuccesful. This problem will go away once all publishers have migrated over to a recent version of pyth-agent.
ema_pricei64
ema_confu64

TakenLoan#

Struct types::TakenLoan.

FieldTypeDescription
nft_collateral_mintPubkey
lender_note_mintPubkey
borrower_note_mintPubkey
apyAPYThousandths of a percent (allows to have 3 decimal points of precision)
termsLoanTerms
is_collateral_frozenu8

UpdateIndex#

Struct types::UpdateIndex.

FieldType
indexu32
mintPubkey

VerificationLevel#

From the program's IDL:

Pyth price updates are bridged to all blockchains via Wormhole.
Using the price updates on another chain requires verifying the signatures of the Wormhole guardians. The usual process is to check the signatures for two thirds of the total number of guardians, but this can be cumbersome on
Solana because of the transaction size limits, so we also allow for partial verification. This enum represents how much a price update has been verified:

  • If Full, we have verified the signatures for two thirds of the current guardians.
  • If Partial, only num_signatures guardian signatures have been checked.

Warning

Using partially verified price updates is dangerous, as it lowers the threshold of guardians that need to collude to produce a malicious price update.

Enum types::VerificationLevel.

VariantFields
Partialnum_signatures: u8
Full

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.