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.
| Crate | carbon-sharky-decoder 2.0.0 |
| Install | cargo add carbon-sharky-decoder@2. |
| Program ID | SHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP (carbon_) |
| Category | Lending |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-sharky-decoder/2.0.0 |
| Source | decoders/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:
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/fulluse {
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(())
}
}RUST_LOG=info cargo runEach 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:
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2use {
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(())
}
}RUST_LOG=info cargo runEach 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::, where data and accounts are the types listed under the variant, exported from carbon_. 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:
- The instruction's program ID is
SHARKobtfF1bHhxD2eqftjHBdVSCbKo9JtgK71FhELP. - The data starts with the variant's discriminator, and the rest deserializes into its data type.
- 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_ too. Accounts after the listed ones are in accounts. as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input. and ., 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.
| Field | Type |
|---|---|
usdc_amount | u64 |
Required accounts: 7; extras go to remaining.
Fields of AddLiquidityTokenPoolInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | pool | Pubkey |
| 2 | usdc_vault | Pubkey |
| 3 | lender | Pubkey |
| 4 | lender_usdc | Pubkey |
| 5 | loan_mint | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
CloseEscrowValueMintAtaAdmin#
Discriminator 04860129a8f8dd1c · data CloseEscrowValueMintAtaAdmin · accounts CloseEscrowValueMintAtaAdminInstructionAccounts.
| Field | Type |
|---|---|
escrow_bump | u8 |
Required accounts: 8; extras go to remaining.
Fields of CloseEscrowValueMintAtaAdminInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | lender | Pubkey |
| 2 | escrow | Pubkey |
| 3 | escrow_ | Pubkey |
| 4 | admin | Pubkey |
| 5 | system_ | Pubkey |
| 6 | token_ | Pubkey |
| 7 | associated_ | Pubkey |
| 8… | remaining | Vec< |
CloseNftList#
Discriminator 23087952da4efca2 · data CloseNftList · accounts CloseNftListInstructionAccounts.
No data fields.
Required accounts: 2; extras go to remaining.
Fields of CloseNftListInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | nft_list | Pubkey |
| 1 | payer | Pubkey |
| 2… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | order_book | Pubkey |
| 1 | payer | Pubkey |
| 2… | remaining | Vec< |
CloseTokenOrderbook#
Discriminator e304e16dcfeb476a · data CloseTokenOrderbook · accounts CloseTokenOrderbookInstructionAccounts.
No data fields.
Required accounts: 3; extras go to remaining.
Fields of CloseTokenOrderbookInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | authority | Pubkey |
| 2 | system_ | Pubkey |
| 3… | remaining | Vec< |
CloseTokenPool#
Discriminator 02fb3604f2c8ae8f · data CloseTokenPool · accounts CloseTokenPoolInstructionAccounts.
No data fields.
Required accounts: 10; extras go to remaining.
Fields of CloseTokenPoolInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | pool | Pubkey |
| 2 | usdc_vault | Pubkey |
| 3 | collateral_ | Pubkey |
| 4 | lender | Pubkey |
| 5 | lender_usdc | Pubkey |
| 6 | lender_ | Pubkey |
| 7 | loan_mint | Pubkey |
| 8 | collateral_ | Pubkey |
| 9 | token_ | Pubkey |
| 10… | remaining | Vec< |
CreateNftList#
Discriminator f326c64cac407f18 · data CreateNftList · accounts CreateNftListInstructionAccounts.
| Field | Type |
|---|---|
collection_ | String |
Required accounts: 2; extras go to remaining.
Fields of CreateNftListInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | nft_list | Pubkey |
| 1 | payer | Pubkey |
| 2… | remaining | Vec< |
CreateOrderBook#
From the program's IDL:
Creates an order book, must be signed by sharky key
Discriminator 997209336444f0c5 · data CreateOrderBook · accounts CreateOrderBookInstructionAccounts.
| Field | Type |
|---|---|
order_ | OrderBookType |
apy | APY |
loan_terms | BookLoanTerms |
fee_ | u16 |
fee_ | Pubkey |
Required accounts: 3; extras go to remaining.
Fields of CreateOrderBookInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | order_book | Pubkey |
| 1 | payer | Pubkey |
| 2 | system_ | Pubkey |
| 3… | remaining | Vec< |
CreateProgramVersion#
Discriminator 67d800ee5c6bdb79 · data CreateProgramVersion · accounts CreateProgramVersionInstructionAccounts.
| Field | Type |
|---|---|
version | u8 |
Required accounts: 4; extras go to remaining.
Fields of CreateProgramVersionInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | authority | Pubkey |
| 1 | program_ | Pubkey |
| 2 | system_ | Pubkey |
| 3 | rent | Pubkey |
| 4… | remaining | Vec< |
CreateTokenOrderbook#
Discriminator 88965e5dd4a2ded6 · data CreateTokenOrderbook · accounts CreateTokenOrderbookInstructionAccounts.
| Field | Type |
|---|---|
duration | u64 |
apr | u32 |
fee_ | u16 |
fee_ | Pubkey |
min_ | Option<u64> |
max_ | Option<u64> |
Required accounts: 5; extras go to remaining.
Fields of CreateTokenOrderbookInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | loan_mint | Pubkey |
| 2 | collateral_ | Pubkey |
| 3 | authority | Pubkey |
| 4 | system_ | Pubkey |
| 5… | remaining | Vec< |
CreateTokenPool#
Discriminator 17a91b7a93a9d198 · data CreateTokenPool · accounts CreateTokenPoolInstructionAccounts.
| Field | Type |
|---|---|
nonce | u64 |
initial_ | u64 |
required_ | u64 |
Required accounts: 10; extras go to remaining.
Fields of CreateTokenPoolInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | pool | Pubkey |
| 2 | usdc_vault | Pubkey |
| 3 | collateral_ | Pubkey |
| 4 | lender | Pubkey |
| 5 | lender_ | Pubkey |
| 6 | loan_mint | Pubkey |
| 7 | collateral_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | system_ | Pubkey |
| 10… | remaining | Vec< |
ExtendLoanCore#
From the program's IDL:
Extend a loan with a new loan (core)
Discriminator 8de35be5c626964f · data ExtendLoanCore · accounts ExtendLoanCoreInstructionAccounts.
| Field | Type |
|---|---|
expected_ | String |
Required accounts: 16; extras go to remaining.
Fields of ExtendLoanCoreInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | new_loan | Pubkey |
| 2 | borrower | Pubkey |
| 3 | lender | Pubkey |
| 4 | new_lender | Pubkey |
| 5 | escrow | Pubkey |
| 6 | new_escrow | Pubkey |
| 7 | value_mint | Pubkey |
| 8 | collateral_ | Pubkey |
| 9 | collection | Option< |
| 10 | order_book | Pubkey |
| 11 | fee_ | Pubkey |
| 12 | system_ | Pubkey |
| 13 | rent | Pubkey |
| 14 | log_wrapper | Option< |
| 15 | mpl_ | Pubkey |
| 16… | remaining | Vec< |
ExtendLoanV3#
Discriminator 471b11834e493e5c · data ExtendLoanV3 · accounts ExtendLoanV3InstructionAccounts.
| Field | Type |
|---|---|
expected_ | String |
Required accounts: 21; extras go to remaining.
Fields of ExtendLoanV3InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | new_loan | Pubkey |
| 2 | borrower | Pubkey |
| 3 | borrower_ | Pubkey |
| 4 | lender | Pubkey |
| 5 | new_lender | Pubkey |
| 6 | escrow | Pubkey |
| 7 | escrow_ | Pubkey |
| 8 | new_escrow | Pubkey |
| 9 | new_ | Pubkey |
| 10 | value_mint | Pubkey |
| 11 | collateral_ | Pubkey |
| 12 | order_book | Pubkey |
| 13 | fee_ | Pubkey |
| 14 | metadata | Pubkey |
| 15 | edition | Pubkey |
| 16 | system_ | Pubkey |
| 17 | token_ | Pubkey |
| 18 | associated_ | Pubkey |
| 19 | rent | Pubkey |
| 20 | mpl_ | Pubkey |
| 21… | remaining | Vec< |
ExtendLoanV3Compressed#
From the program's IDL:
Extend a loan with a new loan (cNFT)
Discriminator 94a14b578a22833e · data ExtendLoanV3Compressed · accounts ExtendLoanV3CompressedInstructionAccounts.
| Field | Type |
|---|---|
expected_ | String |
cnft_root | [u8; 32] |
cnft_ | [u8; 32] |
cnft_ | [u8; 32] |
cnft_nonce | u64 |
cnft_index | u32 |
Required accounts: 18; extras go to remaining.
Fields of ExtendLoanV3CompressedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | new_loan | Pubkey |
| 2 | borrower | Pubkey |
| 3 | lender | Pubkey |
| 4 | new_lender | Pubkey |
| 5 | escrow | Pubkey |
| 6 | new_escrow | Pubkey |
| 7 | value_mint | Pubkey |
| 8 | order_book | Pubkey |
| 9 | fee_ | Pubkey |
| 10 | tree_ | Pubkey |
| 11 | log_wrapper | Pubkey |
| 12 | merkle_tree | Pubkey |
| 13 | system_ | Pubkey |
| 14 | token_ | Pubkey |
| 15 | mpl_ | Pubkey |
| 16 | compression_ | Pubkey |
| 17 | rent | Pubkey |
| 18… | remaining | Vec< |
ExtendTokenLoan#
Discriminator 39213d664656a482 · data ExtendTokenLoan · accounts ExtendTokenLoanInstructionAccounts.
| Field | Type |
|---|---|
new_ | u64 |
expected_ | String |
Required accounts: 20; extras go to remaining.
Fields of ExtendTokenLoanInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | old_loan | Pubkey |
| 2 | new_loan | Pubkey |
| 3 | old_pool | Pubkey |
| 4 | new_pool | Pubkey |
| 5 | old_ | Pubkey |
| 6 | old_ | Pubkey |
| 7 | new_ | Pubkey |
| 8 | new_ | Pubkey |
| 9 | borrower | Pubkey |
| 10 | borrower_ | Pubkey |
| 11 | borrower_ | Pubkey |
| 12 | loan_mint | Pubkey |
| 13 | collateral_ | Pubkey |
| 14 | fee_ | Pubkey |
| 15 | burn_wallet | Pubkey |
| 16 | price_ | Pubkey |
| 17 | token_ | Pubkey |
| 18 | associated_ | Pubkey |
| 19 | system_ | Pubkey |
| 20… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | escrow | Pubkey |
| 2 | collateral_ | Pubkey |
| 3 | collection | Option< |
| 4 | borrower | Pubkey |
| 5 | lender | Pubkey |
| 6 | system_ | Pubkey |
| 7 | rent | Pubkey |
| 8 | log_wrapper | Option< |
| 9 | mpl_ | Pubkey |
| 10… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | escrow | Pubkey |
| 2 | escrow_ | Pubkey |
| 3 | collateral_ | Pubkey |
| 4 | borrower | Pubkey |
| 5 | lender | Pubkey |
| 6 | lender_ | Pubkey |
| 7 | borrower_ | Pubkey |
| 8 | metadata | Pubkey |
| 9 | edition | Pubkey |
| 10 | system_ | Pubkey |
| 11 | token_ | Pubkey |
| 12 | associated_ | Pubkey |
| 13 | rent | Pubkey |
| 14 | mpl_ | Pubkey |
| 15… | remaining | Vec< |
ForecloseLoanV3Compressed#
From the program's IDL:
Forecloses on a taken lone that has met some condition (cNFT)
Discriminator c2c105c17385e7c5 · data ForecloseLoanV3Compressed · accounts ForecloseLoanV3CompressedInstructionAccounts.
| Field | Type |
|---|---|
cnft_root | [u8; 32] |
cnft_ | [u8; 32] |
cnft_ | [u8; 32] |
cnft_nonce | u64 |
cnft_index | u32 |
Required accounts: 12; extras go to remaining.
Fields of ForecloseLoanV3CompressedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | escrow | Pubkey |
| 2 | borrower | Pubkey |
| 3 | lender | Pubkey |
| 4 | tree_ | Pubkey |
| 5 | log_wrapper | Pubkey |
| 6 | merkle_tree | Pubkey |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | mpl_ | Pubkey |
| 10 | compression_ | Pubkey |
| 11 | rent | Pubkey |
| 12… | remaining | Vec< |
ForecloseTokenLoan#
Discriminator c538e1490be8211e · data ForecloseTokenLoan · accounts ForecloseTokenLoanInstructionAccounts.
No data fields.
Required accounts: 10; extras go to remaining.
Fields of ForecloseTokenLoanInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | loan | Pubkey |
| 2 | borrower | Pubkey |
| 3 | pool | Pubkey |
| 4 | lender | Pubkey |
| 5 | lender_ | Pubkey |
| 6 | collateral_ | Pubkey |
| 7 | loan_mint | Pubkey |
| 8 | collateral_ | Pubkey |
| 9 | token_ | Pubkey |
| 10… | remaining | Vec< |
OfferLoan#
From the program's IDL:
Offers a loan for a given order book
Discriminator 2c0c4c90d2d0ef55 · data OfferLoan · accounts OfferLoanInstructionAccounts.
| Field | Type |
|---|---|
escrow_bump | u8 |
principal_ | u64 |
terms_ | Option< |
Required accounts: 11; extras go to remaining.
Fields of OfferLoanInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | lender | Pubkey |
| 1 | lender_ | Pubkey |
| 2 | value_mint | Pubkey |
| 3 | loan | Pubkey |
| 4 | escrow | Pubkey |
| 5 | escrow_ | Pubkey |
| 6 | order_book | Pubkey |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10 | rent | Pubkey |
| 11… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | borrower | Pubkey |
| 2 | lender | Pubkey |
| 3 | escrow | Pubkey |
| 4 | value_mint | Pubkey |
| 5 | collateral_ | Pubkey |
| 6 | collection | Option< |
| 7 | order_book | Pubkey |
| 8 | fee_ | Pubkey |
| 9 | system_ | Pubkey |
| 10 | rent | Pubkey |
| 11 | log_wrapper | Option< |
| 12 | mpl_ | Pubkey |
| 13… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | borrower | Pubkey |
| 2 | borrower_ | Pubkey |
| 3 | lender | Pubkey |
| 4 | escrow | Pubkey |
| 5 | escrow_ | Pubkey |
| 6 | value_mint | Pubkey |
| 7 | collateral_ | Pubkey |
| 8 | order_book | Pubkey |
| 9 | fee_ | Pubkey |
| 10 | metadata | Pubkey |
| 11 | edition | Pubkey |
| 12 | system_ | Pubkey |
| 13 | token_ | Pubkey |
| 14 | associated_ | Pubkey |
| 15 | rent | Pubkey |
| 16 | mpl_ | Pubkey |
| 17… | remaining | Vec< |
RepayLoanV3Compressed#
From the program's IDL:
Repays a given loan in exchange for the NFT (cNFT)
Discriminator 9f9ff5a8bf9a6406 · data RepayLoanV3Compressed · accounts RepayLoanV3CompressedInstructionAccounts.
| Field | Type |
|---|---|
cnft_root | [u8; 32] |
cnft_ | [u8; 32] |
cnft_ | [u8; 32] |
cnft_nonce | u64 |
cnft_index | u32 |
Required accounts: 15; extras go to remaining.
Fields of RepayLoanV3CompressedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | borrower | Pubkey |
| 2 | lender | Pubkey |
| 3 | escrow | Pubkey |
| 4 | value_mint | Pubkey |
| 5 | order_book | Pubkey |
| 6 | fee_ | Pubkey |
| 7 | tree_ | Pubkey |
| 8 | log_wrapper | Pubkey |
| 9 | merkle_tree | Pubkey |
| 10 | system_ | Pubkey |
| 11 | token_ | Pubkey |
| 12 | mpl_ | Pubkey |
| 13 | compression_ | Pubkey |
| 14 | rent | Pubkey |
| 15… | remaining | Vec< |
RepayTokenLoan#
Discriminator d032d027bd9919fb · data RepayTokenLoan · accounts RepayTokenLoanInstructionAccounts.
No data fields.
Required accounts: 13; extras go to remaining.
Fields of RepayTokenLoanInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | loan | Pubkey |
| 2 | pool | Pubkey |
| 3 | lender_usdc | Pubkey |
| 4 | collateral_ | Pubkey |
| 5 | borrower | Pubkey |
| 6 | borrower_ | Pubkey |
| 7 | borrower_ | Pubkey |
| 8 | loan_mint | Pubkey |
| 9 | collateral_ | Pubkey |
| 10 | token_ | Pubkey |
| 11 | associated_ | Pubkey |
| 12 | system_ | Pubkey |
| 13… | remaining | Vec< |
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:
| # | Field | Type |
|---|---|---|
| 0 | loan | Pubkey |
| 1 | lender_ | Option< |
| 2 | lender | Pubkey |
| 3 | value_mint | Pubkey |
| 4 | escrow | Pubkey |
| 5 | escrow_ | Pubkey |
| 6 | system_ | Pubkey |
| 7 | token_ | Pubkey |
| 8… | remaining | Vec< |
TakeLoanCore#
From the program's IDL:
Takes an offered loan in exchange for a valid NFT (core)
Discriminator b26fec3c9f6ceafe · data TakeLoanCore · accounts TakeLoanCoreInstructionAccounts.
| Field | Type |
|---|---|
expected_ | String |
nft_ | Option<u32> |
Required accounts: 11; extras go to remaining.
Fields of TakeLoanCoreInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | lender | Pubkey |
| 1 | borrower | Pubkey |
| 2 | collateral_ | Pubkey |
| 3 | collection | Option< |
| 4 | loan | Pubkey |
| 5 | escrow | Pubkey |
| 6 | order_book | Pubkey |
| 7 | system_ | Pubkey |
| 8 | rent | Pubkey |
| 9 | log_wrapper | Option< |
| 10 | mpl_ | Pubkey |
| 11… | remaining | Vec< |
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.
| Field | Type |
|---|---|
expected_ | String |
nft_ | Option<u32> |
skip_ | bool |
Required accounts: 15; extras go to remaining.
Fields of TakeLoanV3InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | lender | Pubkey |
| 1 | borrower | Pubkey |
| 2 | borrower_ | Pubkey |
| 3 | collateral_ | Pubkey |
| 4 | loan | Pubkey |
| 5 | escrow | Pubkey |
| 6 | escrow_ | Pubkey |
| 7 | order_book | Pubkey |
| 8 | metadata | Pubkey |
| 9 | edition | Pubkey |
| 10 | system_ | Pubkey |
| 11 | token_ | Pubkey |
| 12 | associated_ | Pubkey |
| 13 | rent | Pubkey |
| 14 | mpl_ | Pubkey |
| 15… | remaining | Vec< |
TakeLoanV3Compressed#
From the program's IDL:
Takes an offered loan in exchange for a valid NFT (cNFT)
Discriminator f1726a4f1059e97d · data TakeLoanV3Compressed · accounts TakeLoanV3CompressedInstructionAccounts.
| Field | Type |
|---|---|
expected_ | String |
nft_ | Option<u32> |
cnft_args | CnftArgs |
Required accounts: 14; extras go to remaining.
Fields of TakeLoanV3CompressedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | lender | Pubkey |
| 1 | borrower | Pubkey |
| 2 | loan | Pubkey |
| 3 | escrow | Pubkey |
| 4 | order_book | Pubkey |
| 5 | collateral_ | Pubkey |
| 6 | tree_ | Pubkey |
| 7 | log_wrapper | Pubkey |
| 8 | merkle_tree | Pubkey |
| 9 | system_ | Pubkey |
| 10 | token_ | Pubkey |
| 11 | mpl_ | Pubkey |
| 12 | compression_ | Pubkey |
| 13 | rent | Pubkey |
| 14… | remaining | Vec< |
TakeTokenLoan#
Discriminator ddd87f0a6bbd986f · data TakeTokenLoan · accounts TakeTokenLoanInstructionAccounts.
| Field | Type |
|---|---|
usdc_amount | u64 |
expected_ | String |
Required accounts: 15; extras go to remaining.
Fields of TakeTokenLoanInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | loan | Pubkey |
| 2 | pool | Pubkey |
| 3 | usdc_vault | Pubkey |
| 4 | collateral_ | Pubkey |
| 5 | borrower | Pubkey |
| 6 | borrower_ | Pubkey |
| 7 | borrower_ | Pubkey |
| 8 | fee_ | Pubkey |
| 9 | burn_wallet | Pubkey |
| 10 | price_ | Pubkey |
| 11 | loan_mint | Pubkey |
| 12 | collateral_ | Pubkey |
| 13 | token_ | Pubkey |
| 14 | system_ | Pubkey |
| 15… | remaining | Vec< |
UpdateNftList#
Discriminator d70d19bb0b5d228f · data UpdateNftList · accounts UpdateNftListInstructionAccounts.
| Field | Type |
|---|---|
mints | Vec< |
Required accounts: 2; extras go to remaining.
Fields of UpdateNftListInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | nft_list | Pubkey |
| 1 | payer | Pubkey |
| 2… | remaining | Vec< |
UpdateOrderBook#
From the program's IDL:
Updates an order book, must be signed by sharky key
Discriminator 1f489fe8dc995a6d · data UpdateOrderBook · accounts UpdateOrderBookInstructionAccounts.
| Field | Type |
|---|---|
order_ | Option< |
apy | Option<APY> |
loan_terms | Option< |
fee_ | Option<u16> |
fee_ | Option< |
Required accounts: 2; extras go to remaining.
Fields of UpdateOrderBookInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | order_book | Pubkey |
| 1 | payer | Pubkey |
| 2… | remaining | Vec< |
UpdateProgramVersion#
Discriminator eb84d7e1d52b2b26 · data UpdateProgramVersion · accounts UpdateProgramVersionInstructionAccounts.
| Field | Type |
|---|---|
version | u8 |
Required accounts: 2; extras go to remaining.
Fields of UpdateProgramVersionInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | authority | Pubkey |
| 1 | program_ | Pubkey |
| 2… | remaining | Vec< |
UpdateTokenOrderbook#
Discriminator 13f883459602298f · data UpdateTokenOrderbook · accounts UpdateTokenOrderbookInstructionAccounts.
| Field | Type |
|---|---|
duration | Option<u64> |
apr | Option<u32> |
fee_ | Option<u16> |
fee_ | Option< |
min_ | Option<u64> |
max_ | Option<u64> |
Required accounts: 3; extras go to remaining.
Fields of UpdateTokenOrderbookInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | authority | Pubkey |
| 2 | system_ | Pubkey |
| 3… | remaining | Vec< |
UpdateTokenPool#
Discriminator e11cb50ddc401f66 · data UpdateTokenPool · accounts UpdateTokenPoolInstructionAccounts.
| Field | Type |
|---|---|
new_ | u64 |
Required accounts: 3; extras go to remaining.
Fields of UpdateTokenPoolInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | pool | Pubkey |
| 2 | lender | Pubkey |
| 3… | remaining | Vec< |
WithdrawLiquidityTokenPool#
Discriminator 3767142327b7b440 · data WithdrawLiquidityTokenPool · accounts WithdrawLiquidityTokenPoolInstructionAccounts.
No data fields.
Required accounts: 7; extras go to remaining.
Fields of WithdrawLiquidityTokenPoolInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | orderbook | Pubkey |
| 1 | pool | Pubkey |
| 2 | usdc_vault | Pubkey |
| 3 | lender | Pubkey |
| 4 | lender_usdc | Pubkey |
| 5 | loan_mint | Pubkey |
| 6 | token_ | Pubkey |
| 7… | remaining | Vec< |
Accounts#
Variants of SharkyAccount. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
EscrowPDA#
Discriminator 6d7589b5403041eb · accounts::.
| Field | Type |
|---|---|
bump | u8 |
Loan#
Discriminator 14c34675a5e3b601 · accounts::.
| Field | Type | Description |
|---|---|---|
version | u8 | |
principal_ | u64 | amount in tokens, decimals included |
order_book | Pubkey | |
value_ | Pubkey | Token mint for what the loan is in (spl address) |
escrow_ | u8 | |
loan_state | LoanState | stores start and duration |
NFTList#
Discriminator 2ef468e29823aaef · accounts::.
| Field | Type |
|---|---|
version | u8 |
collection_ | String |
OrderBook#
Discriminator 37e67dda952741f8 · accounts::.
| Field | Type |
|---|---|
version | u8 |
order_ | OrderBookType |
apy | APY |
loan_terms | BookLoanTerms |
fee_ | u16 |
fee_ | Pubkey |
PriceUpdateV2#
Discriminator 22f123639d7ef4cd · accounts::.
| Field | Type |
|---|---|
write_ | Pubkey |
verification_ | VerificationLevel |
price_ | PriceFeedMessage |
posted_slot | u64 |
ProgramVersion#
Discriminator 8a68f4c5ce2f9f9a · accounts::.
| Field | Type |
|---|---|
version | u8 |
bump | u8 |
updated | i64 |
TokenLendingLoan#
Discriminator 30fa85552a0b2d9a · accounts::.
| Field | Type |
|---|---|
orderbook | Pubkey |
borrower | Pubkey |
pool | Pubkey |
principal_ | u64 |
collateral_ | u64 |
start_ts | i64 |
end_ts | i64 |
apr | u32 |
version | u8 |
padding | [u8; 3] |
TokenLendingOrderBook#
Discriminator c0475ca36355271b · accounts::.
| Field | Type |
|---|---|
fee_ | Pubkey |
loan_mint | Pubkey |
collateral_ | Pubkey |
collateral_ | Pubkey |
duration | u64 |
min_ | u64 |
max_ | u64 |
apr | u32 |
fee_ | u16 |
collateral_ | u8 |
version | u8 |
bump | u8 |
padding | [u8; 7] |
TokenLendingPool#
Discriminator 213b0d8799697f92 · accounts::.
| Field | Type |
|---|---|
orderbook | Pubkey |
lender | Pubkey |
usdc_vault | Pubkey |
collateral_ | Pubkey |
nonce | u64 |
total_ | u64 |
available_ | u64 |
collateral_ | u64 |
total_ | u64 |
total_ | u64 |
active_ | u64 |
total_ | u64 |
total_ | u64 |
total_ | u64 |
version | u8 |
bump | u8 |
padding | [u8; 6] |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
APY#
From the program's IDL:
APY settings on an [
OrderBook]
Enum types::APY.
| Variant | Fields |
|---|---|
Fixed | apy: u32 |
Fixed fields:
| Field | Type | Description |
|---|---|---|
apy | u32 | Thousandths of a percent |
BookLoanTerms#
Enum types::.
| Variant | Fields |
|---|---|
Fixed | terms: LoanTermsSpec |
LenderChooses |
CnftArgs#
Struct types::.
| Field | Type |
|---|---|
cnft_root | [u8; 32] |
cnft_ | [u8; 32] |
cnft_ | [u8; 32] |
cnft_nonce | u64 |
cnft_index | u32 |
LoanOffer#
Struct types::.
| Field | Type |
|---|---|
lender_ | Pubkey |
terms_spec | LoanTermsSpec |
offer_time | i64 |
LoanState#
Enum types::.
LoanTerms#
Enum types::.
| Variant | Fields |
|---|---|
Time | start: i64, duration: u64, total_: u64 |
Time fields:
| Field | Type | Description |
|---|---|---|
start | i64 | This is a [UnixTimeStamp] |
duration | u64 | |
total_ | u64 |
LoanTermsSpec#
Enum types::.
| Variant | Fields |
|---|---|
Time | duration: u64 |
OrderBookType#
Enum types::.
| Variant | Fields |
|---|---|
Collection | collection_: Pubkey |
NFTList | list_: Pubkey |
PriceFeedMessage#
Struct types::.
| Field | Type | Description |
|---|---|---|
feed_id | [u8; 32] | FeedId but avoid the type alias because of compatibility issues with Anchor's idl-build feature. |
price | i64 | |
conf | u64 | |
exponent | i32 | |
publish_ | i64 | The timestamp of this price update in seconds |
prev_ | i64 | The 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_price | i64 | |
ema_conf | u64 |
TakenLoan#
Struct types::.
| Field | Type | Description |
|---|---|---|
nft_ | Pubkey | |
lender_ | Pubkey | |
borrower_ | Pubkey | |
apy | APY | Thousandths of a percent (allows to have 3 decimal points of precision) |
terms | LoanTerms | |
is_ | u8 |
UpdateIndex#
Struct types::.
| Field | Type |
|---|---|
index | u32 |
mint | Pubkey |
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, onlynum_guardian signatures have been checked.signatures 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::.
| Variant | Fields |
|---|---|
Partial | num_: u8 |
Full |