mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-21 21:08:07 +00:00
feat: support Pump.fun V2 (Mayhem Mode) and update protocol structures for Nov 11 breaking changes
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "solana-streamer-sdk"
|
name = "solana-streamer-sdk"
|
||||||
version = "1.1.0"
|
version = "1.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "wei <1415121722@qq.com>"]
|
authors = ["William <byteblock6@gmail.com>", "sgxiang <sgxiang@gmail.com>", "wei <1415121722@qq.com>"]
|
||||||
repository = "https://github.com/0xfnzero/solana-streamer"
|
repository = "https://github.com/0xfnzero/solana-streamer"
|
||||||
|
|||||||
@@ -109,14 +109,14 @@ Add the dependency to your `Cargo.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Add to your Cargo.toml
|
# Add to your Cargo.toml
|
||||||
solana-streamer-sdk = { path = "./solana-streamer", version = "1.1.0" }
|
solana-streamer-sdk = { path = "./solana-streamer", version = "1.1.1" }
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use crates.io
|
### Use crates.io
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Add to your Cargo.toml
|
# Add to your Cargo.toml
|
||||||
solana-streamer-sdk = "1.1.0"
|
solana-streamer-sdk = "1.1.1"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔄 Migration Guide
|
## 🔄 Migration Guide
|
||||||
|
|||||||
+2
-2
@@ -108,14 +108,14 @@ git clone https://github.com/0xfnzero/solana-streamer
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
# 添加到您的 Cargo.toml
|
# 添加到您的 Cargo.toml
|
||||||
solana-streamer-sdk = { path = "./solana-streamer", version = "1.1.0" }
|
solana-streamer-sdk = { path = "./solana-streamer", version = "1.1.1" }
|
||||||
```
|
```
|
||||||
|
|
||||||
### 使用 crates.io
|
### 使用 crates.io
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# 添加到您的 Cargo.toml
|
# 添加到您的 Cargo.toml
|
||||||
solana-streamer-sdk = "1.1.0"
|
solana-streamer-sdk = "1.1.1"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔄 迁移指南
|
## 🔄 迁移指南
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ pub enum EventType {
|
|||||||
|
|
||||||
// PumpFun events
|
// PumpFun events
|
||||||
PumpFunCreateToken,
|
PumpFunCreateToken,
|
||||||
|
PumpFunCreateV2Token,
|
||||||
PumpFunBuy,
|
PumpFunBuy,
|
||||||
PumpFunSell,
|
PumpFunSell,
|
||||||
PumpFunMigrate,
|
PumpFunMigrate,
|
||||||
@@ -162,6 +163,7 @@ impl fmt::Display for EventType {
|
|||||||
EventType::PumpSwapDeposit => write!(f, "PumpSwapDeposit"),
|
EventType::PumpSwapDeposit => write!(f, "PumpSwapDeposit"),
|
||||||
EventType::PumpSwapWithdraw => write!(f, "PumpSwapWithdraw"),
|
EventType::PumpSwapWithdraw => write!(f, "PumpSwapWithdraw"),
|
||||||
EventType::PumpFunCreateToken => write!(f, "PumpFunCreateToken"),
|
EventType::PumpFunCreateToken => write!(f, "PumpFunCreateToken"),
|
||||||
|
EventType::PumpFunCreateV2Token => write!(f, "PumpFunCreateV2Token"),
|
||||||
EventType::PumpFunBuy => write!(f, "PumpFunBuy"),
|
EventType::PumpFunBuy => write!(f, "PumpFunBuy"),
|
||||||
EventType::PumpFunSell => write!(f, "PumpFunSell"),
|
EventType::PumpFunSell => write!(f, "PumpFunSell"),
|
||||||
EventType::PumpFunMigrate => write!(f, "PumpFunMigrate"),
|
EventType::PumpFunMigrate => write!(f, "PumpFunMigrate"),
|
||||||
|
|||||||
@@ -38,6 +38,22 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) {
|
|||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
|
DexEvent::PumpFunCreateV2TokenEvent(e) => match cpi_log_event {
|
||||||
|
DexEvent::PumpFunCreateV2TokenEvent(cpie) => {
|
||||||
|
e.mint = cpie.mint;
|
||||||
|
e.bonding_curve = cpie.bonding_curve;
|
||||||
|
e.user = cpie.user;
|
||||||
|
e.creator = cpie.creator;
|
||||||
|
e.timestamp = cpie.timestamp;
|
||||||
|
e.virtual_token_reserves = cpie.virtual_token_reserves;
|
||||||
|
e.virtual_sol_reserves = cpie.virtual_sol_reserves;
|
||||||
|
e.real_token_reserves = cpie.real_token_reserves;
|
||||||
|
e.token_total_supply = cpie.token_total_supply;
|
||||||
|
e.token_program = cpie.token_program;
|
||||||
|
e.is_mayhem_mode = cpie.is_mayhem_mode;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
DexEvent::PumpFunMigrateEvent(e) => match cpi_log_event {
|
DexEvent::PumpFunMigrateEvent(e) => match cpi_log_event {
|
||||||
DexEvent::PumpFunMigrateEvent(cpie) => {
|
DexEvent::PumpFunMigrateEvent(cpie) => {
|
||||||
e.user = cpie.user;
|
e.user = cpie.user;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ pub enum DexEvent {
|
|||||||
|
|
||||||
// PumpFun events
|
// PumpFun events
|
||||||
PumpFunCreateTokenEvent(PumpFunCreateTokenEvent),
|
PumpFunCreateTokenEvent(PumpFunCreateTokenEvent),
|
||||||
|
PumpFunCreateV2TokenEvent(PumpFunCreateV2TokenEvent),
|
||||||
PumpFunTradeEvent(PumpFunTradeEvent),
|
PumpFunTradeEvent(PumpFunTradeEvent),
|
||||||
PumpFunMigrateEvent(PumpFunMigrateEvent),
|
PumpFunMigrateEvent(PumpFunMigrateEvent),
|
||||||
PumpFunBondingCurveAccountEvent(PumpFunBondingCurveAccountEvent),
|
PumpFunBondingCurveAccountEvent(PumpFunBondingCurveAccountEvent),
|
||||||
@@ -87,6 +88,7 @@ impl DexEvent {
|
|||||||
DexEvent::BonkGlobalConfigAccountEvent(e) => &e.metadata,
|
DexEvent::BonkGlobalConfigAccountEvent(e) => &e.metadata,
|
||||||
DexEvent::BonkPlatformConfigAccountEvent(e) => &e.metadata,
|
DexEvent::BonkPlatformConfigAccountEvent(e) => &e.metadata,
|
||||||
DexEvent::PumpFunCreateTokenEvent(e) => &e.metadata,
|
DexEvent::PumpFunCreateTokenEvent(e) => &e.metadata,
|
||||||
|
DexEvent::PumpFunCreateV2TokenEvent(e) => &e.metadata,
|
||||||
DexEvent::PumpFunTradeEvent(e) => &e.metadata,
|
DexEvent::PumpFunTradeEvent(e) => &e.metadata,
|
||||||
DexEvent::PumpFunMigrateEvent(e) => &e.metadata,
|
DexEvent::PumpFunMigrateEvent(e) => &e.metadata,
|
||||||
DexEvent::PumpFunBondingCurveAccountEvent(e) => &e.metadata,
|
DexEvent::PumpFunBondingCurveAccountEvent(e) => &e.metadata,
|
||||||
@@ -138,6 +140,7 @@ impl DexEvent {
|
|||||||
DexEvent::BonkGlobalConfigAccountEvent(e) => &mut e.metadata,
|
DexEvent::BonkGlobalConfigAccountEvent(e) => &mut e.metadata,
|
||||||
DexEvent::BonkPlatformConfigAccountEvent(e) => &mut e.metadata,
|
DexEvent::BonkPlatformConfigAccountEvent(e) => &mut e.metadata,
|
||||||
DexEvent::PumpFunCreateTokenEvent(e) => &mut e.metadata,
|
DexEvent::PumpFunCreateTokenEvent(e) => &mut e.metadata,
|
||||||
|
DexEvent::PumpFunCreateV2TokenEvent(e) => &mut e.metadata,
|
||||||
DexEvent::PumpFunTradeEvent(e) => &mut e.metadata,
|
DexEvent::PumpFunTradeEvent(e) => &mut e.metadata,
|
||||||
DexEvent::PumpFunMigrateEvent(e) => &mut e.metadata,
|
DexEvent::PumpFunMigrateEvent(e) => &mut e.metadata,
|
||||||
DexEvent::PumpFunBondingCurveAccountEvent(e) => &mut e.metadata,
|
DexEvent::PumpFunBondingCurveAccountEvent(e) => &mut e.metadata,
|
||||||
|
|||||||
@@ -36,6 +36,39 @@ pub fn pumpfun_create_token_event_log_decode(data: &[u8]) -> Option<PumpFunCreat
|
|||||||
borsh::from_slice::<PumpFunCreateTokenEvent>(&data[..PUMPFUN_CREATE_TOKEN_EVENT_LOG_SIZE]).ok()
|
borsh::from_slice::<PumpFunCreateTokenEvent>(&data[..PUMPFUN_CREATE_TOKEN_EVENT_LOG_SIZE]).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||||
|
pub struct PumpFunCreateV2TokenEvent {
|
||||||
|
#[borsh(skip)]
|
||||||
|
pub metadata: EventMetadata,
|
||||||
|
pub name: String,
|
||||||
|
pub symbol: String,
|
||||||
|
pub uri: String,
|
||||||
|
pub mint: Pubkey,
|
||||||
|
pub bonding_curve: Pubkey,
|
||||||
|
pub user: Pubkey,
|
||||||
|
pub creator: Pubkey,
|
||||||
|
pub timestamp: i64,
|
||||||
|
pub virtual_token_reserves: u64,
|
||||||
|
pub virtual_sol_reserves: u64,
|
||||||
|
pub real_token_reserves: u64,
|
||||||
|
pub token_total_supply: u64,
|
||||||
|
pub token_program: Pubkey,
|
||||||
|
pub is_mayhem_mode: bool,
|
||||||
|
#[borsh(skip)]
|
||||||
|
pub mint_authority: Pubkey,
|
||||||
|
#[borsh(skip)]
|
||||||
|
pub associated_bonding_curve: Pubkey,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const PUMPFUN_CREATE_V2_TOKEN_EVENT_LOG_SIZE: usize = 257 + 32 + 1;
|
||||||
|
|
||||||
|
pub fn pumpfun_create_v2_token_event_log_decode(data: &[u8]) -> Option<PumpFunCreateV2TokenEvent> {
|
||||||
|
if data.len() < PUMPFUN_CREATE_V2_TOKEN_EVENT_LOG_SIZE {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
borsh::from_slice::<PumpFunCreateV2TokenEvent>(&data[..PUMPFUN_CREATE_V2_TOKEN_EVENT_LOG_SIZE]).ok()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||||
pub struct PumpFunTradeEvent {
|
pub struct PumpFunTradeEvent {
|
||||||
#[borsh(skip)]
|
#[borsh(skip)]
|
||||||
@@ -101,6 +134,10 @@ pub struct PumpFunTradeEvent {
|
|||||||
pub global_volume_accumulator: Pubkey,
|
pub global_volume_accumulator: Pubkey,
|
||||||
#[borsh(skip)]
|
#[borsh(skip)]
|
||||||
pub user_volume_accumulator: Pubkey,
|
pub user_volume_accumulator: Pubkey,
|
||||||
|
#[borsh(skip)]
|
||||||
|
pub fee_config: Pubkey,
|
||||||
|
#[borsh(skip)]
|
||||||
|
pub fee_program: Pubkey,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const PUMPFUN_TRADE_EVENT_LOG_SIZE: usize = 250;
|
pub const PUMPFUN_TRADE_EVENT_LOG_SIZE: usize = 250;
|
||||||
@@ -218,6 +255,7 @@ pub mod discriminators {
|
|||||||
|
|
||||||
// 指令鉴别器
|
// 指令鉴别器
|
||||||
pub const CREATE_TOKEN_IX: &[u8] = &[24, 30, 200, 40, 5, 28, 7, 119];
|
pub const CREATE_TOKEN_IX: &[u8] = &[24, 30, 200, 40, 5, 28, 7, 119];
|
||||||
|
pub const CREATE_V2_TOKEN_IX: &[u8] = &[214, 144, 76, 236, 95, 139, 49, 180];
|
||||||
pub const BUY_IX: &[u8] = &[102, 6, 61, 18, 1, 218, 235, 234];
|
pub const BUY_IX: &[u8] = &[102, 6, 61, 18, 1, 218, 235, 234];
|
||||||
pub const SELL_IX: &[u8] = &[51, 230, 133, 164, 1, 127, 131, 173];
|
pub const SELL_IX: &[u8] = &[51, 230, 133, 164, 1, 127, 131, 173];
|
||||||
pub const MIGRATE_IX: &[u8] = &[155, 234, 231, 146, 236, 158, 162, 30];
|
pub const MIGRATE_IX: &[u8] = &[155, 234, 231, 146, 236, 158, 162, 30];
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use crate::streaming::event_parser::{
|
use crate::streaming::event_parser::{
|
||||||
common::{EventMetadata, EventType},
|
common::{EventMetadata, EventType},
|
||||||
protocols::pumpfun::{
|
protocols::pumpfun::{
|
||||||
discriminators, pumpfun_create_token_event_log_decode, pumpfun_migrate_event_log_decode,
|
discriminators, pumpfun_create_token_event_log_decode, pumpfun_create_v2_token_event_log_decode,
|
||||||
pumpfun_trade_event_log_decode, PumpFunCreateTokenEvent, PumpFunMigrateEvent,
|
pumpfun_migrate_event_log_decode, pumpfun_trade_event_log_decode, PumpFunCreateTokenEvent,
|
||||||
PumpFunTradeEvent,
|
PumpFunCreateV2TokenEvent, PumpFunMigrateEvent, PumpFunTradeEvent,
|
||||||
},
|
},
|
||||||
DexEvent,
|
DexEvent,
|
||||||
};
|
};
|
||||||
@@ -26,6 +26,9 @@ pub fn parse_pumpfun_instruction_data(
|
|||||||
discriminators::CREATE_TOKEN_IX => {
|
discriminators::CREATE_TOKEN_IX => {
|
||||||
parse_create_token_instruction(data, accounts, metadata)
|
parse_create_token_instruction(data, accounts, metadata)
|
||||||
}
|
}
|
||||||
|
discriminators::CREATE_V2_TOKEN_IX => {
|
||||||
|
parse_create_v2_token_instruction(data, accounts, metadata)
|
||||||
|
}
|
||||||
discriminators::BUY_IX => {
|
discriminators::BUY_IX => {
|
||||||
parse_buy_instruction(data, accounts, metadata)
|
parse_buy_instruction(data, accounts, metadata)
|
||||||
}
|
}
|
||||||
@@ -179,6 +182,69 @@ fn parse_create_token_instruction(
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 解析创建 V2 代币指令事件 (SPL-22 Token, Mayhem Mode)
|
||||||
|
fn parse_create_v2_token_instruction(
|
||||||
|
data: &[u8],
|
||||||
|
accounts: &[Pubkey],
|
||||||
|
mut metadata: EventMetadata,
|
||||||
|
) -> Option<DexEvent> {
|
||||||
|
metadata.event_type = EventType::PumpFunCreateV2Token;
|
||||||
|
|
||||||
|
if data.len() < 16 || accounts.len() < 11 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let mut offset = 0;
|
||||||
|
if offset + 4 > data.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let name_len = u32::from_le_bytes(data[offset..offset + 4].try_into().unwrap()) as usize;
|
||||||
|
offset += 4;
|
||||||
|
if offset + name_len > data.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let name = String::from_utf8_lossy(&data[offset..offset + name_len]);
|
||||||
|
offset += name_len;
|
||||||
|
if offset + 4 > data.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let symbol_len = u32::from_le_bytes(data[offset..offset + 4].try_into().unwrap()) as usize;
|
||||||
|
offset += 4;
|
||||||
|
if offset + symbol_len > data.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let symbol = String::from_utf8_lossy(&data[offset..offset + symbol_len]);
|
||||||
|
offset += symbol_len;
|
||||||
|
if offset + 4 > data.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let uri_len = u32::from_le_bytes(data[offset..offset + 4].try_into().unwrap()) as usize;
|
||||||
|
offset += 4;
|
||||||
|
if offset + uri_len > data.len() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let uri = String::from_utf8_lossy(&data[offset..offset + uri_len]);
|
||||||
|
offset += uri_len;
|
||||||
|
let creator = if offset + 32 <= data.len() {
|
||||||
|
Pubkey::new_from_array(data[offset..offset + 32].try_into().ok()?)
|
||||||
|
} else {
|
||||||
|
Pubkey::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
Some(DexEvent::PumpFunCreateV2TokenEvent(PumpFunCreateV2TokenEvent {
|
||||||
|
metadata,
|
||||||
|
name: name.to_string(),
|
||||||
|
symbol: symbol.to_string(),
|
||||||
|
uri: uri.to_string(),
|
||||||
|
creator,
|
||||||
|
mint: accounts[0],
|
||||||
|
mint_authority: accounts[1],
|
||||||
|
bonding_curve: accounts[2],
|
||||||
|
associated_bonding_curve: accounts[3],
|
||||||
|
user: accounts[7],
|
||||||
|
..Default::default()
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
// 解析买入指令事件
|
// 解析买入指令事件
|
||||||
fn parse_buy_instruction(
|
fn parse_buy_instruction(
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
@@ -187,7 +253,7 @@ fn parse_buy_instruction(
|
|||||||
) -> Option<DexEvent> {
|
) -> Option<DexEvent> {
|
||||||
metadata.event_type = EventType::PumpFunBuy;
|
metadata.event_type = EventType::PumpFunBuy;
|
||||||
|
|
||||||
if data.len() < 16 || accounts.len() < 13 {
|
if data.len() < 16 || accounts.len() < 16 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let amount = u64::from_le_bytes(data[0..8].try_into().unwrap());
|
let amount = u64::from_le_bytes(data[0..8].try_into().unwrap());
|
||||||
@@ -208,6 +274,8 @@ fn parse_buy_instruction(
|
|||||||
program: accounts[11],
|
program: accounts[11],
|
||||||
global_volume_accumulator: accounts[12],
|
global_volume_accumulator: accounts[12],
|
||||||
user_volume_accumulator: accounts[13],
|
user_volume_accumulator: accounts[13],
|
||||||
|
fee_config: accounts[14],
|
||||||
|
fee_program: accounts[15],
|
||||||
max_sol_cost,
|
max_sol_cost,
|
||||||
amount,
|
amount,
|
||||||
is_buy: true,
|
is_buy: true,
|
||||||
@@ -223,7 +291,7 @@ fn parse_sell_instruction(
|
|||||||
) -> Option<DexEvent> {
|
) -> Option<DexEvent> {
|
||||||
metadata.event_type = EventType::PumpFunSell;
|
metadata.event_type = EventType::PumpFunSell;
|
||||||
|
|
||||||
if data.len() < 16 || accounts.len() < 11 {
|
if data.len() < 16 || accounts.len() < 14 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let amount = u64::from_le_bytes(data[0..8].try_into().unwrap());
|
let amount = u64::from_le_bytes(data[0..8].try_into().unwrap());
|
||||||
@@ -242,8 +310,10 @@ fn parse_sell_instruction(
|
|||||||
token_program: accounts[9],
|
token_program: accounts[9],
|
||||||
event_authority: accounts[10],
|
event_authority: accounts[10],
|
||||||
program: accounts[11],
|
program: accounts[11],
|
||||||
global_volume_accumulator: *accounts.get(12).unwrap_or(&Pubkey::default()),
|
global_volume_accumulator: Pubkey::default(),
|
||||||
user_volume_accumulator: *accounts.get(13).unwrap_or(&Pubkey::default()),
|
user_volume_accumulator: Pubkey::default(),
|
||||||
|
fee_config: accounts[12],
|
||||||
|
fee_program: accounts[13],
|
||||||
min_sol_output,
|
min_sol_output,
|
||||||
amount,
|
amount,
|
||||||
is_buy: false,
|
is_buy: false,
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ pub struct BondingCurve {
|
|||||||
pub token_total_supply: u64,
|
pub token_total_supply: u64,
|
||||||
pub complete: bool,
|
pub complete: bool,
|
||||||
pub creator: Pubkey,
|
pub creator: Pubkey,
|
||||||
|
pub is_mayhem_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const BONDING_CURVE_SIZE: usize = 8 * 5 + 1 + 32;
|
pub const BONDING_CURVE_SIZE: usize = 8 * 5 + 1 + 32 + 1;
|
||||||
|
|
||||||
pub fn bonding_curve_decode(data: &[u8]) -> Option<BondingCurve> {
|
pub fn bonding_curve_decode(data: &[u8]) -> Option<BondingCurve> {
|
||||||
if data.len() < BONDING_CURVE_SIZE {
|
if data.len() < BONDING_CURVE_SIZE {
|
||||||
@@ -72,9 +73,13 @@ pub struct Global {
|
|||||||
pub fee_recipients: [Pubkey; 7],
|
pub fee_recipients: [Pubkey; 7],
|
||||||
pub set_creator_authority: Pubkey,
|
pub set_creator_authority: Pubkey,
|
||||||
pub admin_set_creator_authority: Pubkey,
|
pub admin_set_creator_authority: Pubkey,
|
||||||
|
pub create_v2_enabled: bool,
|
||||||
|
pub whitelist_pda: Pubkey,
|
||||||
|
pub reserved_fee_recipient: Pubkey,
|
||||||
|
pub mayhem_mode_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const GLOBAL_SIZE: usize = 1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2;
|
pub const GLOBAL_SIZE: usize = 1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2 + 1 + 32 * 2 + 1;
|
||||||
|
|
||||||
pub fn global_decode(data: &[u8]) -> Option<Global> {
|
pub fn global_decode(data: &[u8]) -> Option<Global> {
|
||||||
if data.len() < GLOBAL_SIZE {
|
if data.len() < GLOBAL_SIZE {
|
||||||
|
|||||||
@@ -20,9 +20,12 @@ pub struct GlobalConfig {
|
|||||||
pub protocol_fee_recipients: [Pubkey; 8],
|
pub protocol_fee_recipients: [Pubkey; 8],
|
||||||
pub coin_creator_fee_basis_points: u64,
|
pub coin_creator_fee_basis_points: u64,
|
||||||
pub admin_set_coin_creator_authority: Pubkey,
|
pub admin_set_coin_creator_authority: Pubkey,
|
||||||
|
pub whitelist_pda: Pubkey,
|
||||||
|
pub reserved_fee_recipient: Pubkey,
|
||||||
|
pub mayhem_mode_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const GLOBAL_CONFIG_SIZE: usize = 32 + 8 + 8 + 1 + 32 * 8 + 8 + 32;
|
pub const GLOBAL_CONFIG_SIZE: usize = 32 + 8 + 8 + 1 + 32 * 8 + 8 + 32 + 32 + 32 + 1;
|
||||||
|
|
||||||
pub fn global_config_decode(data: &[u8]) -> Option<GlobalConfig> {
|
pub fn global_config_decode(data: &[u8]) -> Option<GlobalConfig> {
|
||||||
if data.len() < GLOBAL_CONFIG_SIZE {
|
if data.len() < GLOBAL_CONFIG_SIZE {
|
||||||
@@ -67,9 +70,10 @@ pub struct Pool {
|
|||||||
pub pool_quote_token_account: Pubkey,
|
pub pool_quote_token_account: Pubkey,
|
||||||
pub lp_supply: u64,
|
pub lp_supply: u64,
|
||||||
pub coin_creator: Pubkey,
|
pub coin_creator: Pubkey,
|
||||||
|
pub is_mayhem_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const POOL_SIZE: usize = 1 + 2 + 32 * 6 + 8 + 32;
|
pub const POOL_SIZE: usize = 1 + 2 + 32 * 6 + 8 + 32 + 1;
|
||||||
|
|
||||||
pub fn pool_decode(data: &[u8]) -> Option<Pool> {
|
pub fn pool_decode(data: &[u8]) -> Option<Pool> {
|
||||||
if data.len() < POOL_SIZE {
|
if data.len() < POOL_SIZE {
|
||||||
|
|||||||
Reference in New Issue
Block a user