0.7.27 +Refactor

This commit is contained in:
2026-05-10 00:33:01 +02:00
parent cb2e8e7096
commit 1f0137b9de
261 changed files with 12308 additions and 8928 deletions

View File

@@ -2,12 +2,9 @@
//! Meteora Dynamic Bonding Curve (DBC) transaction decoder.
/// Meteora DBC program id.
pub const KB_METEORA_DBC_PROGRAM_ID: &str = "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN";
/// Decoded Meteora DBC create-pool event.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct KbMeteoraDbcCreatePoolDecoded {
pub struct MeteoraDbcCreatePoolDecoded {
/// Parent transaction id.
pub transaction_id: i64,
/// Parent instruction id.
@@ -32,7 +29,7 @@ pub struct KbMeteoraDbcCreatePoolDecoded {
/// Decoded Meteora DBC swap event.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct KbMeteoraDbcSwapDecoded {
pub struct MeteoraDbcSwapDecoded {
/// Parent transaction id.
pub transaction_id: i64,
/// Parent instruction id.
@@ -42,7 +39,7 @@ pub struct KbMeteoraDbcSwapDecoded {
/// Program id.
pub program_id: std::string::String,
/// Trade side relative to normalized base.
pub trade_side: crate::KbSwapTradeSide,
pub trade_side: crate::SwapTradeSide,
/// Optional pool account.
pub pool_account: std::option::Option<std::string::String>,
/// Optional base mint.
@@ -55,15 +52,15 @@ pub struct KbMeteoraDbcSwapDecoded {
/// Decoded Meteora DBC event.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum KbMeteoraDbcDecodedEvent {
pub enum MeteoraDbcDecodedEvent {
/// Create pool / launch pool.
CreatePool(KbMeteoraDbcCreatePoolDecoded),
CreatePool(MeteoraDbcCreatePoolDecoded),
/// Swap / swap2.
Swap(KbMeteoraDbcSwapDecoded),
Swap(MeteoraDbcSwapDecoded),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum KbMeteoraDbcInstructionKind {
enum MeteoraDbcInstructionKind {
CreatePool,
Swap,
Unknown,
@@ -71,9 +68,9 @@ enum KbMeteoraDbcInstructionKind {
/// Meteora DBC decoder.
#[derive(Debug, Clone, Default)]
pub struct KbMeteoraDbcDecoder;
pub struct MeteoraDbcDecoder;
impl KbMeteoraDbcDecoder {
impl MeteoraDbcDecoder {
/// Creates a new decoder.
pub fn new() -> Self {
return Self;
@@ -82,14 +79,14 @@ impl KbMeteoraDbcDecoder {
/// Decodes one projected transaction into zero or more Meteora DBC events.
pub fn decode_transaction(
&self,
transaction: &crate::KbChainTransactionDto,
instructions: &[crate::KbChainInstructionDto],
) -> Result<std::vec::Vec<crate::KbMeteoraDbcDecodedEvent>, crate::KbError> {
transaction: &crate::ChainTransactionDto,
instructions: &[crate::ChainInstructionDto],
) -> Result<std::vec::Vec<crate::MeteoraDbcDecodedEvent>, crate::Error> {
let transaction_id_option = transaction.id;
let transaction_id = match transaction_id_option {
Some(transaction_id) => transaction_id,
None => {
return Err(crate::KbError::InvalidState(format!(
return Err(crate::Error::InvalidState(format!(
"chain transaction '{}' has no internal id",
transaction.signature
)));
@@ -100,13 +97,13 @@ impl KbMeteoraDbcDecoder {
let transaction_json = match transaction_json_result {
Ok(transaction_json) => transaction_json,
Err(error) => {
return Err(crate::KbError::Json(format!(
return Err(crate::Error::Json(format!(
"cannot parse transaction_json for signature '{}': {}",
transaction.signature, error
)));
},
};
let log_messages = kb_extract_log_messages(&transaction_json);
let log_messages = extract_log_messages(&transaction_json);
let mut decoded_events = std::vec::Vec::new();
for instruction in instructions {
if instruction.parent_instruction_id.is_some() {
@@ -117,7 +114,7 @@ impl KbMeteoraDbcDecoder {
Some(program_id) => program_id,
None => continue,
};
if program_id.as_str() != crate::KB_METEORA_DBC_PROGRAM_ID {
if program_id.as_str() != crate::METEORA_DBC_PROGRAM_ID {
continue;
}
let instruction_id_option = instruction.id;
@@ -125,45 +122,43 @@ impl KbMeteoraDbcDecoder {
Some(instruction_id) => instruction_id,
None => continue,
};
let accounts_result = kb_parse_accounts_json(instruction.accounts_json.as_str());
let accounts_result = parse_accounts_json(instruction.accounts_json.as_str());
let accounts = match accounts_result {
Ok(accounts) => accounts,
Err(error) => return Err(error),
};
let parsed_json_result =
kb_parse_optional_parsed_json(instruction.parsed_json.as_ref());
let parsed_json_result = parse_optional_parsed_json(instruction.parsed_json.as_ref());
let parsed_json = match parsed_json_result {
Ok(parsed_json) => parsed_json,
Err(error) => return Err(error),
};
let instruction_kind =
kb_classify_instruction_kind(parsed_json.as_ref(), &log_messages);
let pool_account = kb_extract_string_by_candidate_keys(
let instruction_kind = classify_instruction_kind(parsed_json.as_ref(), &log_messages);
let pool_account = extract_string_by_candidate_keys(
parsed_json.as_ref(),
&["pool", "poolAccount", "poolState", "virtualPool", "poolKey"],
)
.or_else(|| return kb_extract_account(&accounts, 0));
let token_a_mint = kb_extract_string_by_candidate_keys(
.or_else(|| return extract_account(&accounts, 0));
let token_a_mint = extract_string_by_candidate_keys(
parsed_json.as_ref(),
&["baseMint", "tokenAMint", "mintA", "token0Mint", "mint0"],
)
.or_else(|| return kb_extract_account(&accounts, 1));
let token_b_mint = kb_extract_string_by_candidate_keys(
.or_else(|| return extract_account(&accounts, 1));
let token_b_mint = extract_string_by_candidate_keys(
parsed_json.as_ref(),
&["quoteMint", "tokenBMint", "mintB", "token1Mint", "mint1"],
)
.or_else(|| return kb_extract_account(&accounts, 2));
let config_account = kb_extract_string_by_candidate_keys(
.or_else(|| return extract_account(&accounts, 2));
let config_account = extract_string_by_candidate_keys(
parsed_json.as_ref(),
&["poolConfig", "config", "dbcConfig", "curveConfig"],
)
.or_else(|| return kb_extract_account(&accounts, 3));
let creator = kb_extract_string_by_candidate_keys(
.or_else(|| return extract_account(&accounts, 3));
let creator = extract_string_by_candidate_keys(
parsed_json.as_ref(),
&["creator", "poolCreator", "owner", "user"],
)
.or_else(|| return kb_extract_account(&accounts, 4));
if instruction_kind == KbMeteoraDbcInstructionKind::CreatePool {
.or_else(|| return extract_account(&accounts, 4));
if instruction_kind == MeteoraDbcInstructionKind::CreatePool {
let payload_json = serde_json::json!({
"decoder": "meteora_dbc",
"eventKind": "create_pool",
@@ -180,8 +175,8 @@ impl KbMeteoraDbcDecoder {
"configAccount": config_account,
"creator": creator
});
decoded_events.push(crate::KbMeteoraDbcDecodedEvent::CreatePool(
crate::KbMeteoraDbcCreatePoolDecoded {
decoded_events.push(crate::MeteoraDbcDecodedEvent::CreatePool(
crate::MeteoraDbcCreatePoolDecoded {
transaction_id,
instruction_id,
signature: transaction.signature.clone(),
@@ -196,8 +191,8 @@ impl KbMeteoraDbcDecoder {
));
continue;
}
if instruction_kind == KbMeteoraDbcInstructionKind::Swap {
let trade_side = kb_infer_trade_side(&log_messages);
if instruction_kind == MeteoraDbcInstructionKind::Swap {
let trade_side = infer_trade_side(&log_messages);
let payload_json = serde_json::json!({
"decoder": "meteora_dbc",
"eventKind": "swap",
@@ -213,8 +208,8 @@ impl KbMeteoraDbcDecoder {
"tokenBMint": token_b_mint,
"tradeSide": format!("{:?}", trade_side)
});
decoded_events.push(crate::KbMeteoraDbcDecodedEvent::Swap(
crate::KbMeteoraDbcSwapDecoded {
decoded_events.push(crate::MeteoraDbcDecodedEvent::Swap(
crate::MeteoraDbcSwapDecoded {
transaction_id,
instruction_id,
signature: transaction.signature.clone(),
@@ -232,7 +227,7 @@ impl KbMeteoraDbcDecoder {
}
}
fn kb_extract_log_messages(
fn extract_log_messages(
transaction_json: &serde_json::Value,
) -> std::vec::Vec<std::string::String> {
let mut messages = std::vec::Vec::new();
@@ -260,22 +255,22 @@ fn kb_extract_log_messages(
return messages;
}
fn kb_log_messages_contain_any_keyword(
fn log_messages_contain_any_keyword(
log_messages: &[std::string::String],
keywords: &[&str],
) -> bool {
for keyword in keywords {
if kb_log_messages_contain_keyword(log_messages, keyword) {
if log_messages_contain_keyword(log_messages, keyword) {
return true;
}
}
return false;
}
fn kb_log_messages_contain_keyword(log_messages: &[std::string::String], keyword: &str) -> bool {
let keyword_normalized = kb_normalize_log_text(keyword);
fn log_messages_contain_keyword(log_messages: &[std::string::String], keyword: &str) -> bool {
let keyword_normalized = normalize_log_text(keyword);
for log_message in log_messages {
let log_normalized = kb_normalize_log_text(log_message.as_str());
let log_normalized = normalize_log_text(log_message.as_str());
if log_normalized.contains(keyword_normalized.as_str()) {
return true;
}
@@ -283,7 +278,7 @@ fn kb_log_messages_contain_keyword(log_messages: &[std::string::String], keyword
return false;
}
fn kb_normalize_log_text(value: &str) -> std::string::String {
fn normalize_log_text(value: &str) -> std::string::String {
let mut normalized = std::string::String::new();
for character in value.chars() {
if character.is_ascii_alphanumeric() {
@@ -293,14 +288,14 @@ fn kb_normalize_log_text(value: &str) -> std::string::String {
return normalized;
}
fn kb_parse_accounts_json(
fn parse_accounts_json(
accounts_json: &str,
) -> Result<std::vec::Vec<std::string::String>, crate::KbError> {
) -> Result<std::vec::Vec<std::string::String>, crate::Error> {
let values_result = serde_json::from_str::<std::vec::Vec<serde_json::Value>>(accounts_json);
let values = match values_result {
Ok(values) => values,
Err(error) => {
return Err(crate::KbError::Json(format!(
return Err(crate::Error::Json(format!(
"cannot parse instruction accounts_json '{}': {}",
accounts_json, error
)));
@@ -316,9 +311,9 @@ fn kb_parse_accounts_json(
return Ok(accounts);
}
fn kb_parse_optional_parsed_json(
fn parse_optional_parsed_json(
parsed_json: std::option::Option<&std::string::String>,
) -> Result<std::option::Option<serde_json::Value>, crate::KbError> {
) -> Result<std::option::Option<serde_json::Value>, crate::Error> {
let parsed_json = match parsed_json {
Some(parsed_json) => parsed_json,
None => return Ok(None),
@@ -327,7 +322,7 @@ fn kb_parse_optional_parsed_json(
match value_result {
Ok(value) => return Ok(Some(value)),
Err(error) => {
return Err(crate::KbError::Json(format!(
return Err(crate::Error::Json(format!(
"cannot parse instruction parsed_json '{}': {}",
parsed_json, error
)));
@@ -335,7 +330,7 @@ fn kb_parse_optional_parsed_json(
}
}
fn kb_extract_string_by_candidate_keys(
fn extract_string_by_candidate_keys(
value: std::option::Option<&serde_json::Value>,
candidate_keys: &[&str],
) -> std::option::Option<std::string::String> {
@@ -343,10 +338,10 @@ fn kb_extract_string_by_candidate_keys(
Some(value) => value,
None => return None,
};
return kb_extract_string_by_candidate_keys_inner(value, candidate_keys);
return extract_string_by_candidate_keys_inner(value, candidate_keys);
}
fn kb_extract_string_by_candidate_keys_inner(
fn extract_string_by_candidate_keys_inner(
value: &serde_json::Value,
candidate_keys: &[&str],
) -> std::option::Option<std::string::String> {
@@ -362,7 +357,7 @@ fn kb_extract_string_by_candidate_keys_inner(
}
for nested_value in object.values() {
let nested_result =
kb_extract_string_by_candidate_keys_inner(nested_value, candidate_keys);
extract_string_by_candidate_keys_inner(nested_value, candidate_keys);
if nested_result.is_some() {
return nested_result;
}
@@ -372,7 +367,7 @@ fn kb_extract_string_by_candidate_keys_inner(
if let Some(array) = value.as_array() {
for nested_value in array {
let nested_result =
kb_extract_string_by_candidate_keys_inner(nested_value, candidate_keys);
extract_string_by_candidate_keys_inner(nested_value, candidate_keys);
if nested_result.is_some() {
return nested_result;
}
@@ -381,7 +376,7 @@ fn kb_extract_string_by_candidate_keys_inner(
return None;
}
fn kb_value_contains_any_key(
fn value_contains_any_key(
value: std::option::Option<&serde_json::Value>,
candidate_keys: &[&str],
) -> bool {
@@ -389,10 +384,10 @@ fn kb_value_contains_any_key(
Some(value) => value,
None => return false,
};
return kb_value_contains_any_key_inner(value, candidate_keys);
return value_contains_any_key_inner(value, candidate_keys);
}
fn kb_value_contains_any_key_inner(value: &serde_json::Value, candidate_keys: &[&str]) -> bool {
fn value_contains_any_key_inner(value: &serde_json::Value, candidate_keys: &[&str]) -> bool {
if let Some(object) = value.as_object() {
for candidate_key in candidate_keys {
if object.contains_key(*candidate_key) {
@@ -400,7 +395,7 @@ fn kb_value_contains_any_key_inner(value: &serde_json::Value, candidate_keys: &[
}
}
for nested_value in object.values() {
if kb_value_contains_any_key_inner(nested_value, candidate_keys) {
if value_contains_any_key_inner(nested_value, candidate_keys) {
return true;
}
}
@@ -408,7 +403,7 @@ fn kb_value_contains_any_key_inner(value: &serde_json::Value, candidate_keys: &[
}
if let Some(array) = value.as_array() {
for nested_value in array {
if kb_value_contains_any_key_inner(nested_value, candidate_keys) {
if value_contains_any_key_inner(nested_value, candidate_keys) {
return true;
}
}
@@ -416,7 +411,7 @@ fn kb_value_contains_any_key_inner(value: &serde_json::Value, candidate_keys: &[
return false;
}
fn kb_extract_account(
fn extract_account(
accounts: &[std::string::String],
index: usize,
) -> std::option::Option<std::string::String> {
@@ -426,59 +421,59 @@ fn kb_extract_account(
return Some(accounts[index].clone());
}
fn kb_infer_trade_side(log_messages: &[std::string::String]) -> crate::KbSwapTradeSide {
if kb_log_messages_contain_keyword(log_messages, "buy") {
return crate::KbSwapTradeSide::BuyBase;
fn infer_trade_side(log_messages: &[std::string::String]) -> crate::SwapTradeSide {
if log_messages_contain_keyword(log_messages, "buy") {
return crate::SwapTradeSide::BuyBase;
}
if kb_log_messages_contain_keyword(log_messages, "sell") {
return crate::KbSwapTradeSide::SellBase;
if log_messages_contain_keyword(log_messages, "sell") {
return crate::SwapTradeSide::SellBase;
}
return crate::KbSwapTradeSide::Unknown;
return crate::SwapTradeSide::Unknown;
}
fn kb_classify_instruction_kind(
fn classify_instruction_kind(
parsed_json: std::option::Option<&serde_json::Value>,
log_messages: &[std::string::String],
) -> KbMeteoraDbcInstructionKind {
let parsed_instruction_name = kb_extract_string_by_candidate_keys(
) -> MeteoraDbcInstructionKind {
let parsed_instruction_name = extract_string_by_candidate_keys(
parsed_json,
&["instruction", "instructionName", "type", "name"],
);
if let Some(parsed_instruction_name) = parsed_instruction_name {
let normalized = kb_normalize_log_text(parsed_instruction_name.as_str());
let normalized = normalize_log_text(parsed_instruction_name.as_str());
if normalized.contains("createpool")
|| normalized.contains("initializepool")
|| normalized.contains("launchpool")
{
return KbMeteoraDbcInstructionKind::CreatePool;
return MeteoraDbcInstructionKind::CreatePool;
}
if normalized == "swap" || normalized == "swap2" {
return KbMeteoraDbcInstructionKind::Swap;
return MeteoraDbcInstructionKind::Swap;
}
}
let has_create_config = kb_value_contains_any_key(
let has_create_config = value_contains_any_key(
parsed_json,
&["poolConfig", "migrationQuoteThreshold", "curveConfig", "dbcConfig"],
);
if has_create_config {
return KbMeteoraDbcInstructionKind::CreatePool;
return MeteoraDbcInstructionKind::CreatePool;
}
if kb_log_messages_contain_any_keyword(
if log_messages_contain_any_keyword(
log_messages,
&["create_pool", "createpool", "initialize_pool", "initializepool", "launch_pool"],
) {
return KbMeteoraDbcInstructionKind::CreatePool;
return MeteoraDbcInstructionKind::CreatePool;
}
if kb_log_messages_contain_any_keyword(log_messages, &["swap2", "swap"]) {
return KbMeteoraDbcInstructionKind::Swap;
if log_messages_contain_any_keyword(log_messages, &["swap2", "swap"]) {
return MeteoraDbcInstructionKind::Swap;
}
return KbMeteoraDbcInstructionKind::Unknown;
return MeteoraDbcInstructionKind::Unknown;
}
#[cfg(test)]
mod tests {
fn make_create_transaction() -> crate::KbChainTransactionDto {
let mut dto = crate::KbChainTransactionDto::new(
fn make_create_transaction() -> crate::ChainTransactionDto {
let mut dto = crate::ChainTransactionDto::new(
"sig-meteora-dbc-create-1".to_string(),
Some(888001),
Some(1779300001),
@@ -505,19 +500,19 @@ mod tests {
return dto;
}
fn make_create_instruction() -> crate::KbChainInstructionDto {
let mut dto = crate::KbChainInstructionDto::new(
fn make_create_instruction() -> crate::ChainInstructionDto {
let mut dto = crate::ChainInstructionDto::new(
301,
None,
0,
None,
Some(crate::KB_METEORA_DBC_PROGRAM_ID.to_string()),
Some(crate::METEORA_DBC_PROGRAM_ID.to_string()),
Some("meteora-dbc".to_string()),
Some(1),
serde_json::json!([
"DbcPool111",
"DbcTokenA111",
"So11111111111111111111111111111111111111112",
crate::WSOL_MINT_ID,
"DbcConfig111",
"DbcCreator111"
])
@@ -529,7 +524,7 @@ mod tests {
"info": {
"pool": "DbcPool111",
"baseMint": "DbcTokenA111",
"quoteMint": "So11111111111111111111111111111111111111112",
"quoteMint": crate::WSOL_MINT_ID,
"poolConfig": "DbcConfig111",
"creator": "DbcCreator111"
}
@@ -541,8 +536,8 @@ mod tests {
return dto;
}
fn make_swap_transaction() -> crate::KbChainTransactionDto {
let mut dto = crate::KbChainTransactionDto::new(
fn make_swap_transaction() -> crate::ChainTransactionDto {
let mut dto = crate::ChainTransactionDto::new(
"sig-meteora-dbc-swap-1".to_string(),
Some(888002),
Some(1779300002),
@@ -569,21 +564,17 @@ mod tests {
return dto;
}
fn make_swap_instruction() -> crate::KbChainInstructionDto {
let mut dto = crate::KbChainInstructionDto::new(
fn make_swap_instruction() -> crate::ChainInstructionDto {
let mut dto = crate::ChainInstructionDto::new(
303,
None,
0,
None,
Some(crate::KB_METEORA_DBC_PROGRAM_ID.to_string()),
Some(crate::METEORA_DBC_PROGRAM_ID.to_string()),
Some("meteora-dbc".to_string()),
Some(1),
serde_json::json!([
"DbcPoolSwap111",
"DbcSwapTokenA111",
"So11111111111111111111111111111111111111112"
])
.to_string(),
serde_json::json!(["DbcPoolSwap111", "DbcSwapTokenA111", crate::WSOL_MINT_ID])
.to_string(),
None,
None,
Some(
@@ -591,7 +582,7 @@ mod tests {
"info": {
"pool": "DbcPoolSwap111",
"baseMint": "DbcSwapTokenA111",
"quoteMint": "So11111111111111111111111111111111111111112"
"quoteMint": crate::WSOL_MINT_ID
}
})
.to_string(),
@@ -603,7 +594,7 @@ mod tests {
#[test]
fn meteora_dbc_create_pool_is_detected() {
let decoder = crate::KbMeteoraDbcDecoder::new();
let decoder = crate::MeteoraDbcDecoder::new();
let transaction = make_create_transaction();
let instructions = vec![make_create_instruction()];
let decoded_result = decoder.decode_transaction(&transaction, &instructions);
@@ -613,18 +604,15 @@ mod tests {
};
assert_eq!(decoded.len(), 1);
match &decoded[0] {
crate::KbMeteoraDbcDecodedEvent::CreatePool(event) => {
crate::MeteoraDbcDecodedEvent::CreatePool(event) => {
assert_eq!(event.transaction_id, 301);
assert_eq!(event.instruction_id, 302);
assert_eq!(event.pool_account, Some("DbcPool111".to_string()));
assert_eq!(event.token_a_mint, Some("DbcTokenA111".to_string()));
assert_eq!(
event.token_b_mint,
Some("So11111111111111111111111111111111111111112".to_string())
);
assert_eq!(event.token_b_mint, Some(crate::WSOL_MINT_ID.to_string()));
assert_eq!(event.config_account, Some("DbcConfig111".to_string()));
},
crate::KbMeteoraDbcDecodedEvent::Swap(_) => {
crate::MeteoraDbcDecodedEvent::Swap(_) => {
panic!("unexpected swap event")
},
}
@@ -632,7 +620,7 @@ mod tests {
#[test]
fn meteora_dbc_swap_is_detected() {
let decoder = crate::KbMeteoraDbcDecoder::new();
let decoder = crate::MeteoraDbcDecoder::new();
let transaction = make_swap_transaction();
let instructions = vec![make_swap_instruction()];
let decoded_result = decoder.decode_transaction(&transaction, &instructions);
@@ -642,17 +630,14 @@ mod tests {
};
assert_eq!(decoded.len(), 1);
match &decoded[0] {
crate::KbMeteoraDbcDecodedEvent::Swap(event) => {
crate::MeteoraDbcDecodedEvent::Swap(event) => {
assert_eq!(event.transaction_id, 303);
assert_eq!(event.instruction_id, 304);
assert_eq!(event.pool_account, Some("DbcPoolSwap111".to_string()));
assert_eq!(event.token_a_mint, Some("DbcSwapTokenA111".to_string()));
assert_eq!(
event.token_b_mint,
Some("So11111111111111111111111111111111111111112".to_string())
);
assert_eq!(event.token_b_mint, Some(crate::WSOL_MINT_ID.to_string()));
},
crate::KbMeteoraDbcDecodedEvent::CreatePool(_) => {
crate::MeteoraDbcDecodedEvent::CreatePool(_) => {
panic!("unexpected create event")
},
}
@@ -660,13 +645,13 @@ mod tests {
#[test]
fn meteora_dbc_quote_mint_alone_does_not_trigger_create_pool() {
let decoder = crate::KbMeteoraDbcDecoder::new();
let decoder = crate::MeteoraDbcDecoder::new();
let transaction = make_swap_transaction();
let mut instruction = make_swap_instruction();
instruction.parsed_json = Some(
serde_json::json!({
"info": {
"quoteMint": "So11111111111111111111111111111111111111112"
"quoteMint": crate::WSOL_MINT_ID
}
})
.to_string(),
@@ -678,8 +663,8 @@ mod tests {
};
assert_eq!(decoded.len(), 1);
match &decoded[0] {
crate::KbMeteoraDbcDecodedEvent::Swap(_) => {},
crate::KbMeteoraDbcDecodedEvent::CreatePool(_) => {
crate::MeteoraDbcDecodedEvent::Swap(_) => {},
crate::MeteoraDbcDecodedEvent::CreatePool(_) => {
panic!("unexpected create event")
},
}
@@ -687,7 +672,7 @@ mod tests {
#[test]
fn meteora_dbc_pool_config_triggers_create_pool() {
let decoder = crate::KbMeteoraDbcDecoder::new();
let decoder = crate::MeteoraDbcDecoder::new();
let transaction = make_create_transaction();
let instruction = make_create_instruction();
let decoded_result = decoder.decode_transaction(&transaction, &[instruction]);
@@ -697,8 +682,8 @@ mod tests {
};
assert_eq!(decoded.len(), 1);
match &decoded[0] {
crate::KbMeteoraDbcDecodedEvent::CreatePool(_) => {},
crate::KbMeteoraDbcDecodedEvent::Swap(_) => {
crate::MeteoraDbcDecodedEvent::CreatePool(_) => {},
crate::MeteoraDbcDecodedEvent::Swap(_) => {
panic!("unexpected swap event")
},
}